-
Notifications
You must be signed in to change notification settings - Fork 4
/
jest.config.cjs
52 lines (48 loc) · 1.43 KB
/
jest.config.cjs
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
47
48
49
50
51
52
const { pathsToModuleNameMapper } = require('ts-jest');
const appRoot = require('app-root-path');
const { compilerOptions: baseTsConfig } = require(
`${appRoot}/config/tsconfig.test.json`
);
// Take the paths from tsconfig automatically from base tsconfig.json
// @link https://kulshekhar.github.io/ts-jest/docs/paths-mapping
const getTsConfigBasePaths = () => {
return baseTsConfig.paths
? pathsToModuleNameMapper(baseTsConfig.paths, {
prefix: '<rootDir>/',
})
: {};
};
const modules = {};
/** @type {import('ts-jest').JestConfigWithTsJest} */
//@ts-check
module.exports = {
collectCoverageFrom: [
'packages/**/src/**/*.{ts,tsx}',
'!**/*.styles.ts*',
'!**/index.ts*',
'!**/*test*/**',
'!**/*fixture*/**',
'!**/*template*/**',
'!**/*stories*',
'!**/*.development.*',
],
moduleDirectories: ['node_modules'],
moduleFileExtensions: ['js', 'json', 'ts', 'tsx'],
moduleNameMapper: {
'\\.(css|less|sass|scss)$': '<rootDir>/scripts/styleMock.cjs',
...getTsConfigBasePaths(),
...modules,
},
preset: 'ts-jest',
testEnvironment: 'jsdom',
testRegex: '(test|spec).tsx?$',
testPathIgnorePatterns: ['/playwright/'],
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
setupFilesAfterEnv: ['<rootDir>/scripts/setupTests.ts'],
transformIgnorePatterns: [
'/node_modules/(?!(react-dnd|dnd-core|@react-dnd|react-dnd-html5-backend|react-tweet)/)',
],
watchman: false,
};