-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.preset.js
66 lines (64 loc) · 1.77 KB
/
jest.preset.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const nxPreset = require('@nx/jest/preset').default;
module.exports = {
...nxPreset,
setupFiles: [`${process.cwd()}/tools/test/jest.setup.ts`],
// collectCoverage: true,
coverageReporters: ['text', 'lcov', 'html'],
moduleNameMapper: {
'@formkit/auto-animate/react': `${process.cwd()}/__mocks__/@formkit/auto-animate/react.js`,
'auto-animate': `${process.cwd()}/__mocks__/auto-animate.tsx`,
},
transform: {
'^.+\\.[tj]sx?$': [
'@swc/jest',
{
jsc: {
parser: { syntax: 'typescript', tsx: true },
transform: { react: { runtime: 'automatic' } },
},
},
],
'^.+\\.mjs$': [
'@swc/jest',
{
jsc: {
parser: { syntax: 'ecmascript' },
},
},
],
// avoid issue with import.meta
'^.+\\.[tj]s$': [
'ts-jest',
{
diagnostics: {
ignoreCodes: [1343],
},
astTransformers: {
before: [
{
path: 'ts-jest-mock-import-meta', // or 'node_modules/ts-jest-mock-import-meta'
},
],
},
},
],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'mjs'],
coverageThreshold: {
// global: {
// branches: 80,
// functions: 80,
// lines: 80,
// statements: 80,
// },
},
coveragePathIgnorePatterns: ['/node_modules/'],
/* TODO: Update to latest Jest snapshotFormat
* By default Nx has kept the older style of Jest Snapshot formats
* to prevent breaking of any existing tests with snapshots.
* It's recommend you update to the latest format.
* You can do this by removing snapshotFormat property
* and running tests with --update-snapshot flag.
*/
snapshotFormat: { escapeString: true, printBasicPrototype: true },
};