-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.config.ts
39 lines (37 loc) · 1.25 KB
/
jest.config.ts
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
import type { JestConfigWithTsJest } from 'ts-jest'
import { pathsToModuleNameMapper } from 'ts-jest'
import { compilerOptions } from './tsconfig.json'
import { UserScripts } from './utils'
const scripts = new UserScripts()
const jestConfig: JestConfigWithTsJest = {
projects: [
{
displayName: 'build',
roots: ['<rootDir>/test/'],
preset: 'ts-jest',
transform: { '^.+\\.(t|j)sx?$': '@swc/jest' },
coveragePathIgnorePatterns: ['/node_modules/', '<rootDir>/utils/'],
},
...scripts.tests.map(({ name, path }) => ({
displayName: name,
roots: [path],
coveragePathIgnorePatterns: [
'/node_modules/',
`${path}/test/`,
`<rootDir>/scripts/(?!${name})/`,
],
preset: 'ts-jest',
transform: { '^.+\\.(t|j)sx?$': '@swc/jest' },
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/utils/testSetup.ts'],
modulePaths: [compilerOptions.baseUrl],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),
transformIgnorePatterns: [
'<rootDir>/node_modules/(?!(stimulus-use|@stackoverflow/stacks-icons))',
],
})),
],
coverageDirectory: 'coverage',
collectCoverageFrom: ['**/*.{js,ts,jsx,tsx}'],
}
export default jestConfig