-
Notifications
You must be signed in to change notification settings - Fork 134
/
wallaby.config.js
85 lines (74 loc) · 2.37 KB
/
wallaby.config.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
'use strict';
const ignore = [
'!**/node_modules/**',
'!**/dist/**',
'!**/build/**',
'!**/coverage/**',
'!**/.git/**',
'!**/.idea/**',
'!**/.vscode/**',
'!**/.cache/**',
'!**/.DS_Store/**',
'!**/flow-typed/**',
];
module.exports = (wallabyInitial) => {
return {
files: [
...ignore,
{ pattern: '*', instrument: false },
{ pattern: '.*', instrument: false },
{ pattern: '**/__sandbox__/**/*', instrument: false },
{ pattern: '**/__sandbox__/**/.*', instrument: false },
'**/!(*.test).+(js|jsx|ts|tsx|mjs)',
{ pattern: '**/.*', instrument: false },
{ pattern: '**/!(*.test).*', instrument: false },
],
tests: [
...ignore,
'!**/__sandbox__/**',
'**/*.test.+(js|jsx|ts|tsx|mjs)',
],
compilers: {
'src/**/*.+(js|jsx)': wallabyInitial.compilers.babel(),
'**/*.+(ts|tsx)': wallabyInitial.compilers.babel(),
},
hints: {
ignoreCoverage: /ignore coverage/,
},
env: {
type: 'node',
runner: 'node',
},
testFramework: 'jest',
setup: (wallabySetup) => {
/**
* link node_modules inside wallaby's temp dir
*
* https://github.com/wallabyjs/public/issues/1663#issuecomment-389717074
*/
const fs = require('fs');
const path = require('path');
const realModules = path.join(
wallabySetup.localProjectDir,
'node_modules',
);
const linkedModules = path.join(
wallabySetup.projectCacheDir,
'node_modules',
);
try {
fs.symlinkSync(realModules, linkedModules, 'dir');
// eslint-disable-next-line no-empty
} catch (error) {}
/**
* https://github.com/wallabyjs/public/issues/1268#issuecomment-323237993
*
* reset to expected wallaby process.cwd
*/
process.chdir(wallabySetup.projectCacheDir);
process.env.NODE_ENV = 'test';
const jestConfig = require('./jest.config.js');
wallabySetup.testFramework.configure(jestConfig);
},
};
};