-
Notifications
You must be signed in to change notification settings - Fork 1
/
wallaby.js
52 lines (47 loc) · 1.14 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
module.exports = function (wallaby) {
// Need to set this variable to get
process.env.DEBUG = '*,-ava,-babel';
return {
files: [
'src/**/*.js'
],
tests: [
'test/**/*.js'
],
env: {
type: 'node',
runner: 'node',
params: {
env: 'DEBUG=*,-ava,-babel'
}
},
compilers: {
'**/*.js': wallaby.compilers.babel()
},
testFramework: 'ava',
debug: true,
workers: {recycle: true},
setup: w => {
if (!global._callsiteReplaced) {
const Module = require('module').Module;
const modulePrototype = Module.prototype;
const originalRequire = modulePrototype.require;
modulePrototype.require = function (filePath) {
if (filePath === 'callsite') {
return () => {
const result = originalRequire.call(this, filePath)();
result.shift();
console.log(result.map(r => r.getFileName()));
const fileName = result[1].getFileName()
.replace(w.projectCacheDir, 'enchanted-debug');
result[1] = {getFileName: () => fileName};
return result;
};
}
return originalRequire.call(this, filePath);
};
global._callsiteReplaced = true;
}
}
};
};