forked from JetBrains/ring-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wallaby.config.js
97 lines (82 loc) · 2.17 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
86
87
88
89
90
91
92
93
94
95
96
97
const path = require('path');
const wallabyWebpack = require('wallaby-webpack');
const webpackConfig = require('./webpack.config');
const webpackTestConfig = require('./webpack-test.config');
const postcssLoaderPath = require.resolve('postcss-loader');
const addConfig = rule => {
rule.use.forEach((loader, index) => {
if (loader === postcssLoaderPath) {
rule.use[index] = {
loader,
options: {
config: __dirname
}
};
}
});
};
module.exports = wallaby => {
webpackConfig.componentsPath.
push(path.join(wallaby.projectCacheDir, 'components'));
webpackTestConfig.entryPatterns = [
'test-helpers/mocha-globals.js',
'components/**/*.test.js'
];
addConfig(webpackConfig.loaders.scssLoader);
addConfig(webpackConfig.loaders.cssLoader);
return {
files: [
// test helpers
{
pattern: 'test-helpers/mocha-globals.js',
instrument: false,
load: false
},
// test frameworks
{
pattern: 'node_modules/sinon/pkg/sinon.js',
instrument: false
},
{
pattern: 'node_modules/chai/chai.js',
instrument: false
},
{
pattern: 'node_modules/chai-as-promised/lib/chai-as-promised.js',
instrument: false
},
{
pattern: 'node_modules/chai-dom/chai-dom.js',
instrument: false
},
{
pattern: 'node_modules/sinon-chai/lib/sinon-chai.js',
instrument: false
},
{
pattern: 'node_modules/karma-chai-plugins/chai-adapter.js',
instrument: false
},
// files
{pattern: 'components/**/*.*', load: false},
{pattern: 'components/**/*.test.js', ignore: true}
],
tests: [
{pattern: 'components/**/*.test.js', load: false}
],
testFramework: 'mocha',
compilers: {
'**/*.js': wallaby.compilers.babel()
},
postprocessor: wallabyWebpack(webpackTestConfig),
/* global window */
bootstrap: function bootstrap() {
// required to trigger tests loading
window.__moduleBundler.loadTests();
},
env: {
kind: 'electron'
},
reportConsoleErrorAsError: true
};
};