Skip to content

Commit ab159fd

Browse files
committed
fixup: svelte5 alias for jest
1 parent abd02d6 commit ab159fd

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
run: npm run test:${{ matrix.test-runner }}
6060

6161
- name: ▶️ Run type-checks
62-
if: ${{ matrix.node == '20' && matrix.svelte == '4' }}
62+
if: ${{ matrix.node == '20' && matrix.svelte == '4' && matrix.test-runner == 'vitest:jsdom' }}
6363
run: npm run types
6464

6565
- name: ⬆️ Upload coverage report

jest.config.cjs renamed to jest.config.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
module.exports = {
1+
import { VERSION as SVELTE_VERSION } from 'svelte/compiler'
2+
3+
const IS_SVELTE_5 = SVELTE_VERSION >= '5'
4+
5+
export default {
26
testMatch: ['<rootDir>/src/__tests__/**/*.test.js'],
37
transform: {
48
'^.+\\.svelte$': 'svelte-jester',
@@ -10,6 +14,9 @@ module.exports = {
1014
injectGlobals: false,
1115
moduleNameMapper: {
1216
'^vitest$': '<rootDir>/src/__tests__/_jest-vitest-alias.js',
17+
'^@testing-library/svelte$': IS_SVELTE_5
18+
? '<rootDir>/src/svelte5-index.js'
19+
: '<rootDir>/src/index.js',
1320
},
1421
resetMocks: true,
1522
restoreMocks: true,

0 commit comments

Comments
 (0)