-
Notifications
You must be signed in to change notification settings - Fork 4
/
wallaby.js
42 lines (34 loc) · 1.33 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
module.exports = function(wallaby) {
var path = require('path');
process.env.NODE_ENV = 'test';
process.env.NODE_PATH += path.delimiter + path.join(__dirname, 'node_modules') + path.delimiter + path.join(__dirname, 'node_modules/react-scripts/node_modules');
require('module').Module._initPaths();
return {
files: [{ pattern: 'src/setupTests.ts', instrument: false }, 'src/**/*.+(ts|tsx|jsx|json|snap|css|less|sass|scss|jpg|jpeg|gif|png|svg)', '!src/**/*.test.ts?(x)'],
tests: ['src/**/*.test.ts?(x)'],
env: {
type: 'node',
runner: 'node'
},
preprocessors: {
'**/*.js?(x)': file =>
require('@babel/core').transform(file.content, {
sourceMap: true,
compact: false,
filename: file.path,
presets: ['react-app']
})
},
hints: {
ignoreCoverage: /istanbul ignore next/
},
filesWithNoCoverageCalculated: ['src/util/**/*'],
setup: wallaby => {
const jestConfig = require('react-scripts/scripts/utils/createJestConfig')(p => require.resolve('react-scripts/' + p));
Object.keys(jestConfig.transform || {}).forEach(k => ~k.indexOf('^.+\\.(js|jsx') && void delete jestConfig.transform[k]);
delete jestConfig.testEnvironment;
wallaby.testFramework.configure(jestConfig);
},
testFramework: 'jest'
};
};