-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathjest.unit.config.ts
More file actions
46 lines (41 loc) · 1.49 KB
/
Copy pathjest.unit.config.ts
File metadata and controls
46 lines (41 loc) · 1.49 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
/**
* @jest-config-loader esbuild-register
*/
import type { Config } from 'jest';
// ensure tests run in utc, like they will on cicd and on server; https://stackoverflow.com/a/56277249/15593329
process.env.TZ = 'UTC';
// ensure tests run like on local machines, so snapshots are equal on local && cicd
process.env.FORCE_COLOR = 'true';
// https://jestjs.io/docs/configuration
const config: Config = {
verbose: true,
reporters: [
['default', { summaryThreshold: 0 }], // ensure we always get a failure summary at the bottom, to avoid the hunt
['test-fns/slowtest.reporter.jest', { slow: '10s', output: '.log/slowtest/unit.report.json' }],
],
testEnvironment: 'node',
moduleFileExtensions: ['js', 'ts'],
moduleNameMapper: {
'^@src/(.*)$': '<rootDir>/src/$1',
},
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
transformIgnorePatterns: [
// here's an example of how to ignore esm module transformation, when needed
// 'node_modules/(?!(@octokit|universal-user-agent|before-after-hook)/)',
],
testMatch: [
// note: order matters
'**/*.test.ts',
'!**/*.acceptance.test.ts',
'!**/*.integration.test.ts',
'!**/.agent/.cache/**',
'!**/.yalc/**',
],
setupFilesAfterEnv: ['./jest.unit.env.ts'],
// use 50% of threads to leave headroom for other processes
maxWorkers: '50%', // https://stackoverflow.com/questions/71287710/why-does-jest-run-faster-with-maxworkers-50
};
// eslint-disable-next-line import/no-default-export
export default config;