-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
52 lines (50 loc) · 1.49 KB
/
jest.config.js
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 fs = require('node:fs');
const { getPathAliases } = require('@oreillymedia/chassis-core/lib/build/getPathAliases.cjs');
const { getTransformedLibraries } = require('@oreillymedia/chassis-core/lib/test/jest/getTransformedLibraries.cjs');
const dockerPath = '/orm/service';
module.exports = {
coverageDirectory: '<rootDir>/src/coverage/jest',
coveragePathIgnorePatterns: ['jest/', 'node_modules/'],
coverageReporters: ['json'],
maxWorkers: process.env.CI?.toLowerCase() === 'true' ? '25%' : '50%',
moduleNameMapper: {
'\\.(css)$': 'identity-obj-proxy',
'\\.(svg)$': '<rootDir>/jest/testSvgMock.js',
...getPathAliases('jest')
},
reporters: [
'default',
[
'jest-junit',
{
suiteName: 'Jest Tests',
outputDirectory: './src/coverage',
outputName: 'junit-jest-tests.xml'
}
]
],
roots: ['<rootDir>/src'],
rootDir: fs.existsSync(dockerPath) ? dockerPath : process.cwd(),
setupFiles: [
'<rootDir>/jest/testSetup.js',
'jest-canvas-mock'
],
setupFilesAfterEnv: [
'@testing-library/jest-dom',
'<rootDir>/msw/jest/setupAfterEnv.js'
],
testEnvironment: '@oreillymedia/chassis-core/lib/jest/js-dom-extended-environment.cjs',
testEnvironmentOptions: {
customExportConditions: ['msw'],
url: 'http://localhost'
},
transform: {
'^.*\\.[tj]sx?$': [
'@oreillymedia/chassis-core/lib/esbuild/esbuild-transformer.js',
{}
]
},
transformIgnorePatterns: [
...getTransformedLibraries()
]
};