forked from Workday/canvas-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wallaby.js
42 lines (34 loc) · 1.24 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
const path = require('path');
module.exports = wallaby => {
return {
files: [
'jest.config.js',
'jest/setupTests.ts',
'modules/**/*.ts?(x)',
'!**/*.spec.ts?(x)',
'!**/*.d.ts',
'!**/stories*.{ts,tsx,js,jsx}',
{pattern: 'modules/**/node_modules/**', ignore: true},
],
tests: ['modules/**/*.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
jestConfig.moduleNameMapper = {
'@workday/canvas-kit-react-(.*)': '<rootDir>/modules/$1/react',
},
w.testFramework.configure(jestConfig);
},
};
};