-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.cjs
More file actions
46 lines (45 loc) · 1.35 KB
/
Copy pathjest.config.cjs
File metadata and controls
46 lines (45 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Plain @swc/jest setup (no Next.js involved post-migration — next/jest used
// to wrap this and read next.config.js, which no longer exists, and used
// SWC under the hood too). @swc/jest transpiles TS to JS per-file without
// full type-checking (typechecking is covered separately by `tsc -b`) and,
// unlike ts-jest, has no TS `module`-kind gate on `import.meta` syntax —
// needed because ringRecorder.ts uses `import.meta.url` to build its Worker
// URL (for Vite's worker bundling).
/** @type {import('jest').Config} */
const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.cjs'],
testEnvironment: 'jest-environment-jsdom',
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'^\\$decoder-lib/(.*)$': '<rootDir>/src/lib/$1',
},
testMatch: [
'**/__tests__/**/*.[jt]s?(x)',
'**/?(*.)+(spec|test).[jt]s?(x)'
],
testPathIgnorePatterns: [
'/node_modules/',
],
transform: {
'^.+\\.(t|j)sx?$': ['@swc/jest', {
jsc: {
parser: { syntax: 'typescript', tsx: true },
target: 'es2022',
},
}],
},
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'!src/**/*.d.ts',
'!src/**/*.stories.{js,jsx,ts,tsx}',
],
coverageThreshold: {
global: {
branches: 70,
functions: 70,
lines: 70,
statements: 70,
},
},
}
module.exports = customJestConfig