/
wallaby.js
72 lines (60 loc) · 1.87 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
module.exports = function (wallaby) {
return {
maxConsoleMessagesPerTest: 1000,
files: [
// system.js and configuration
{pattern: 'jspm_packages/system.src.js', instrument: false},
{pattern: 'jspm.config.js', instrument: false},
{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},
// source files (`load: false` as the files will be loaded by system.js loader)
{pattern: 'lib/**/*.js', load: false}
],
tests: [
// test files (`load: false` as we will load tests manually)
{pattern: 'spec/**/*.spec.js', load: false}
],
compilers: {
'**/*.js': wallaby.compilers.babel({
presets: ['es2015'],
plugins: ['transform-object-rest-spread']
})
},
env: {
kind: 'electron'
},
// telling wallaby to serve jspm_packages project folder
// as is from wallaby web server
middleware: (app, express) => {
app.use('/jspm_packages',
express.static(
require('path').join(__dirname, 'jspm_packages')
)
);
},
setup: function (wallaby) {
sinon.assert.expose(chai.assert, { prefix: "" });
window.assert = chai.assert;
mocha.timeout(3000);
wallaby.delayStart();
System.config({
transpiler: 'none'
});
System.trace = true;
System.packages = {};
var promises = [];
for (var i = 0, len = wallaby.tests.length; i < len; i++) {
promises.push(System['import'](wallaby.tests[i]));
}
Promise.all(promises).then(function () {
wallaby.start();
}).catch(function (e) {
setTimeout(function () {
throw e;
}, 0);
});
},
testFramework: 'mocha'
};
};