-
Notifications
You must be signed in to change notification settings - Fork 221
/
wallaby.js
48 lines (40 loc) · 1.75 KB
/
wallaby.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
const path = require('path');
module.exports = wallaby => {
return {
files: [
'jest.config.js',
'jest/setupTests.ts',
'jest/verifyComponent.tsx',
'modules/**/*.ts?(x)',
'!**/*.spec.ts?(x)',
'!**/*.d.ts',
'!**/stories*.{ts,tsx,js,jsx}',
{pattern: 'modules/**/node_modules/**', ignore: true},
],
tests: ['modules/**/*.spec.ts?(x)', 'jest/**/*.spec.ts?(x)'],
env: {
type: 'node',
runner: 'node',
},
testFramework: 'jest',
compilers: {
'**/*.ts?(x)': wallaby.compilers.babel(), // We're using Babel to compile all files seen by Jest
},
setup: w => {
console.log('wallaby.projectCacheDir', w.projectCacheDir);
const jestConfig = require('./jest.config.js');
// Wallaby compiles, instruments and copies files found in `files` to the projectCacheDir. We need to tell Jest about this file
jestConfig.setupFilesAfterEnv = [`${w.projectCacheDir}/jest/setupTests.js`];
// Tell Jest how to resolve symlinked modules. Without this, Jest will look at source TS files and not at Wallaby's compiled & instrumented files
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
(jestConfig.moduleNameMapper = {
'@workday/canvas-kit-react/([^/]+)(/?.*)': '<rootDir>/modules/react/$1/$2',
'@workday/canvas-kit-labs-react/([^/]+)(/?.*)': '<rootDir>/modules/labs-react/$1/$2',
'@workday/canvas-kit-preview-react/([^/]+)(/?.*)': '<rootDir>/modules/preview-react/$1/$2',
'@workday/canvas-kit-(?:(?!react|css|labs|preview))([^/]+)(/?.*)': '<rootDir>/modules/$1', // Non react, labs, preview, and css modules
}),
w.testFramework.configure(jestConfig);
},
maxConsoleMessagesPerTest: 10000,
};
};