-
Notifications
You must be signed in to change notification settings - Fork 12
/
jest.config.ts
41 lines (37 loc) · 1.18 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
40
41
import type { JestConfigWithTsJest } from 'ts-jest';
import { pathsToModuleNameMapper } from 'ts-jest';
import { compilerOptions } from './tsconfig.json';
// https://jestjs.io/docs/en/configuration
const config: JestConfigWithTsJest = {
bail: process.env.CI === 'true' ? 0 : 1,
transform: {
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: 'tests/tsconfig.json',
diagnostics: {
warnOnly: true,
},
},
],
},
cache: process.env.CI !== 'true', // disable caching in CI environments
testEnvironment: 'node',
roots: ['<rootDir>'],
// https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/',
}),
verbose: true,
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
};
const githubActionsReporters: JestConfigWithTsJest['reporters'] = [
['github-actions', { silent: false }],
'summary',
];
if (process.env.GITHUB_ACTIONS === 'true') {
config.reporters = githubActionsReporters;
}
export default config;