-
Notifications
You must be signed in to change notification settings - Fork 1
/
wallaby.js
73 lines (60 loc) · 1.86 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
73
/* eslint-env node */
/* global requirejs */
module.exports = function () {
var path = require('path');
var aureliaJson = require('./aurelia_project/aurelia.json');
return {
debug: true,
files: [
{ pattern: 'node_modules/bluebird/js/browser/bluebird.core.js', instrument: false },
{ pattern: 'scripts/require.js', instrument: false },
{ pattern: 'src/**/*.ts', load: false },
{ pattern: 'test/unit/setup.ts', load: false }
],
tests: [
{ pattern: 'test/unit/**/*.spec.ts', load: false }
],
env: {
kind: 'electron'
},
middleware: function (app, express) {
app.use('/node_modules',
express.static(path.join(__dirname, 'node_modules')));
},
setup: (function (wallaby) {
wallaby.delayStart();
requirejs.config({
packages: [
// packages
]
});
require(['/test/unit/setup.js'].concat(wallaby.tests), function () {
wallaby.start();
});
}).toString()
.replace(
'// packages',
aureliaJson.build.bundles[2].dependencies.reduce(function (prev, curr) {
var moduleName, modulePath, moduleMain;
if (curr.path) {
moduleName = moduleMain = curr.name;
modulePath = path.relative(
__dirname,
path.resolve(__dirname, 'aurelia_project', curr.path))
.split('\\').join('/');
if (curr.main) {
moduleMain = curr.main;
}
}
else {
moduleName = moduleMain = curr;
modulePath = 'node_modules/' + moduleName + '/dist/amd';
}
return prev
+ '{ name: ' + JSON.stringify(moduleName)
+ ', location: ' + JSON.stringify(modulePath)
+ ', main: ' + JSON.stringify(moduleMain)
+ '},';
}, ''))
};
};