-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwallaby.js
55 lines (50 loc) · 1.56 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
49
50
51
52
53
54
55
const typescript = require('typescript');
const tsconfig = require('./tsconfig.test.json');
const identityObjectProxy = require('identity-obj-proxy');
module.exports = function(wallaby) {
return {
files: [
'packages/**/package.json',
'packages/**/*.ts?(x)',
'packages/**/*.css',
'!packages/**/*.test.ts?(x)',
],
tests: ['packages/**/*.test.ts?(x)'],
debug: true,
testFramework: 'jest',
env: {
type: 'node',
},
hints: {
ignoreCoverage: /ignore coverage/,
},
setup: w => {
let jestConfig = global._modifiedJestConfig;
if (!jestConfig) {
jestConfig = global._modifiedJestConfig = require('./package.json').jest;
const path = require('path');
const globby = require('globby');
const originalModuleNameMapper = jestConfig.moduleNameMapper;
jestConfig.moduleNameMapper = globby
.sync(path.join(w.projectCacheDir, 'packages/*/package.json'))
.reduce((acc, v) => {
const packageJsonPath = v;
acc['^' + require(packageJsonPath).name] = path.dirname(
packageJsonPath,
);
return acc;
}, {});
jestConfig.moduleNameMapper = {
...jestConfig.moduleNameMapper,
...originalModuleNameMapper,
};
}
wallaby.testFramework.configure(jestConfig);
},
compilers: {
'packages/**/*.ts?(x)': wallaby.compilers.typeScript(
tsconfig.compilerOptions,
),
},
};
};