-
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathjest.config.js
More file actions
35 lines (32 loc) · 1.12 KB
/
jest.config.js
File metadata and controls
35 lines (32 loc) · 1.12 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
const fs = require('fs');
const path = require('path');
// Discover js/ directories in custom modules, resolving symlinks to real
// paths. Jest resolves symlinks internally, so roots must use real paths
// for test files to be matched.
const dirs = ['web/modules/custom'];
const roots = [];
dirs.forEach((dir) => {
if (fs.existsSync(dir)) {
fs.readdirSync(dir).forEach((name) => {
const jsDir = path.resolve(dir, name, 'js');
if (fs.existsSync(jsDir)) {
roots.push(jsDir);
}
});
}
});
module.exports = {
testEnvironment: 'jest-environment-jsdom',
roots: roots.length > 0 ? roots : [path.resolve('web/modules/custom')],
testRegex: 'web/modules/custom/.+\\.test\\.js$',
testPathIgnorePatterns: ['/node_modules/', '/vendor/'],
modulePathIgnorePatterns: [
'<rootDir>/web/core/',
'<rootDir>/web/modules/contrib/',
'<rootDir>/web/themes/',
'<rootDir>/.vortex/',
],
collectCoverageFrom: ['web/modules/custom/**/js/**/*.js', '!**/*.test.js'],
coverageReporters: ['text', 'lcov', 'html', ['cobertura', { file: 'cobertura.xml' }]],
coverageDirectory: '.logs/coverage/jest',
};