-
Notifications
You must be signed in to change notification settings - Fork 273
/
wallaby.config.js
56 lines (46 loc) · 1.51 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
/* eslint-disable import/no-extraneous-dependencies,global-require */
module.exports = () => {
const config = {
files: [
{ pattern: 'lib/**/*.js' },
{ pattern: 'test/_*.js', instrument: false },
// static files
{ pattern: 'test/fixtures/**', load: false, instrument: false },
{ pattern: 'package.json', load: false }
],
tests: [
{ pattern: 'test/*.test.js' }
],
testFramework: 'mocha',
env: {
type: 'node',
runner: 'node'
},
// eslint-disable-next-line no-shadow
setup: (wallaby) => {
const mocha = wallaby.testFramework;
mocha.ui('bdd');
const webpackToolkit = require('webpack-toolkit');
const { PACKAGE_NAME } = require('./lib/config');
const OldInMemoryCompiler = webpackToolkit.InMemoryCompiler;
if (!OldInMemoryCompiler.patched) {
// eslint-disable-next-line no-multi-assign
const NewInMemoryCompiler = webpackToolkit.InMemoryCompiler = function patched(cfg) {
cfg.resolve = {
alias: {
[PACKAGE_NAME]: `${wallaby.localProjectDir}`
}
};
cfg.resolveLoader = {
modules: [`${wallaby.localProjectDir}/node_modules`]
};
NewInMemoryCompiler.prototype = OldInMemoryCompiler.prototype;
// eslint-disable-next-line prefer-rest-params
return OldInMemoryCompiler.apply(this, arguments);
};
NewInMemoryCompiler.patched = true;
}
}
};
return config;
};