This repository has been archived by the owner on Oct 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathwallaby.js
39 lines (35 loc) · 1.44 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
module.exports = function(wallaby) {
return {
files: [
'packages/*/src/**/*.ts',
'packages/*/src/**/*.json',
{ pattern: 'packages/*/fixtures/**/*', instrument: false },
{ pattern: 'packages/typewiz/dist/**.js', instrument: false },
{ pattern: 'packages/typewiz/package.json', instrument: false },
{ pattern: 'packages/*/src/**/*.spec.ts', ignore: true },
],
tests: ['packages/*/src/**/*.spec.ts'],
env: {
type: 'node',
runner: 'node',
},
testFramework: 'jest',
setup: () => {
if (!global._vmPatched) {
const vm = require('vm');
const createContext = vm.createContext;
const runInNewContext = vm.Script.prototype.runInNewContext;
const wallabyGlobals = { $_$wp, $_$wpe, $_$w, $_$wf, $_$wv, $_$tracer };
vm.createContext = function() {
arguments[0] = Object.assign(arguments[0] || {}, wallabyGlobals);
return createContext.apply(this, arguments);
};
vm.Script.prototype.runInNewContext = function() {
arguments[0] = Object.assign(arguments[0] || {}, wallabyGlobals);
return runInNewContext.apply(this, arguments);
};
global._vmPatched = true;
}
},
};
};