Skip to content

Commit 9527a8f

Browse files
authored
chore: Add wallaby config (Workday#297)
1 parent 888f815 commit 9527a8f

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

Diff for: wallaby.js

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
const path = require('path');
2+
3+
module.exports = wallaby => {
4+
return {
5+
files: [
6+
'jest.config.js',
7+
'jest/setupTests.ts',
8+
'modules/**/*.ts?(x)',
9+
'!**/*.spec.ts?(x)',
10+
'!**/*.d.ts',
11+
'!**/stories*.{ts,tsx,js,jsx}',
12+
{pattern: 'modules/**/node_modules/**', ignore: true},
13+
],
14+
tests: ['modules/**/*.spec.ts?(x)'],
15+
16+
env: {
17+
type: 'node',
18+
runner: 'node',
19+
},
20+
21+
testFramework: 'jest',
22+
23+
compilers: {
24+
'**/*.ts?(x)': wallaby.compilers.babel(), // We're using Babel to compile all files seen by Jest
25+
},
26+
27+
setup: w => {
28+
console.log('wallaby.projectCacheDir', w.projectCacheDir);
29+
const jestConfig = require('./jest.config.js');
30+
31+
// Wallaby compiles, instruments and copies files found in `files` to the projectCacheDir. We need to tell Jest about this file
32+
jestConfig.setupFilesAfterEnv = [`${w.projectCacheDir}/jest/setupTests.js`];
33+
34+
// Tell Jest how to resolve symlinked modules. Without this, Jest will look at source TS files and not at Wallaby's compiled & instrumented files
35+
jestConfig.moduleNameMapper = {
36+
'@workday/canvas-kit-react-(.*)': '<rootDir>/modules/$1/react',
37+
},
38+
39+
w.testFramework.configure(jestConfig);
40+
},
41+
};
42+
};

0 commit comments

Comments
 (0)