-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathjest.config.js
More file actions
60 lines (54 loc) · 1.19 KB
/
jest.config.js
File metadata and controls
60 lines (54 loc) · 1.19 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* Jest project config defaults
*
* @type {ProjectConfig}
*/
const config = {
cacheDirectory: '<rootDir>/.cache/jest',
coveragePathIgnorePatterns: ['.eslintrc.js', '.test.(cjs|js)'],
// Enable Babel transforms until Jest supports ESM and `import()`
// See: https://jestjs.io/docs/ecmascript-modules
transform: {
'^.+\\.(cjs|js)$': ['babel-jest', { rootMode: 'upward' }]
}
}
/**
* Jest config
*
* @type {Config}
*/
export default {
collectCoverageFrom: ['**/assets/js/**/*.{cjs,js}'],
coverageProvider: 'v8',
projects: [
{
...config,
displayName: 'JavaScript behaviour tests',
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/**/*.test.{cjs,js}']
}
],
// Reset mocks between tests
resetMocks: true,
resetModules: true,
restoreMocks: true,
clearMocks: true,
// Enable GitHub Actions reporter UI and xunit
reporters: [
'default',
'github-actions',
[
'jest-junit',
{
outputFile: 'reports/test-js-units.xml'
}
]
]
}
/**
* @typedef {Exclude<Config['projects'][0], string>} ProjectConfig
*/
/**
* @import { Config } from 'jest'
*/