-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.config.js
56 lines (47 loc) · 1.82 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
53
54
55
56
/**
* For a detailed explanation regarding each configuration property, visit: https://jestjs.io/docs/en/configuration.html
*/
export default {
/**
* Makes Jest run in non-browser mode. This is needed to prevent Mongoose to think it's running in a web browser
* which causes it to use a different ObjectId implementation, causing faulty behaviour.
*/
testEnvironment: 'jest-environment-jsdom',
/** Only look for spec.js files in the src folder, mainly to avoid running the Cypress spec files as Jest tests. */
testMatch: ['**/*.spec.js'],
/**
* Code coverage settings.
* v8 is currently (2021-03-22) a faster but more experimental coverage instrumenter that comes with V8.
* It also knows all the supported syntax of current Node version (unlike the default babel parser).
* The CI pipelines require cobertura and text for it's reporting.
* The `collectCoverageFrom` option is used to prevent the report from only considering files that were
* loaded by the tests.
*/
// coverageProvider: 'v8',
collectCoverage: true,
coverageDirectory: 'build/code-coverage',
coverageReporters: ['text', 'lcov'],
collectCoverageFrom: [
'src/**/*.js'
],
injectGlobals: true,
moduleNameMapper: {},
/**
* Restores the mocks e.g. `jest.spyOn()` to be undone between tests.
* This prevents tests from seeing the mocks from a previous `it()` (which would make them order dependent and is bad).
*/
restoreMocks: true,
/**
* Configures test reporters, including xUnit XML output (for Jenkins).
*/
reporters: [
'default', // Keep Jest default reporter
['jest-junit', { outputDirectory: 'build/unit-tests' }],
],
setupFilesAfterEnv: [
"<rootDir>/jest.setup.js",
],
transform: {},
// Indicates whether each individual test should be reported during the run
verbose: true,
};