forked from aburtsev/codelab.ai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.preset.js
41 lines (38 loc) · 1.68 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
const nxPreset = require('@nx/jest/preset').default
const testTimeout = process.env.CI ? 30000 : 20000
const JEST_CONFIG_PATH = `${__dirname}/scripts/jest`
module.exports = {
...nxPreset,
setupFiles: [`${JEST_CONFIG_PATH}/setupFiles.js`],
// globalSetup: `${JEST_CONFIG_PATH}/globalSetup.js`,
// globalTeardown: `${JEST_CONFIG_PATH}/globalTeardown.js`
setupFilesAfterEnv: [
'@testing-library/jest-dom',
`${JEST_CONFIG_PATH}/setupFilesAfterEnv.js`,
],
testTimeout,
/**
* Some NPM modules are written in ES6, and must be transformed with babel. node_modules is ignored by default because there are too many packages to transform, so we only transform the ones we have to.
*/
// transformIgnorePatterns: ['<rootDir>/node_modules/(?!(prettier)/)'],
transform: {
'\\.(css|styl|less|sass|scss|png|jpg|svg|ttf|woff|woff2)$':
'jest-transform-stub',
'\\.(cypher|cyp)$': 'jest-text-transformer',
},
/* 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.
* Example: "nx affected --targets=test --update-snapshot"
* More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format
*/
snapshotFormat: { escapeString: true, printBasicPrototype: true },
/**
* https://github.com/jestjs/jest/issues/13576#issuecomment-1572682459
*/
// collectCoverage: true,
// coverageDirectory: `${process.env.NX_WORKSPACE_ROOT}/coverage/${process.env['NX_TASK_TARGET_PROJECT']}`,
}