forked from NationalLibraryOfNorway/ngx-mime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwallaby.js
112 lines (90 loc) · 3.79 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
module.exports = function (wallaby) {
var compilerOptions = Object.assign(
require('./tsconfig.json').compilerOptions,
require('./src/lib/tsconfig.spec.json').compilerOptions);
return {
files: [
{pattern: 'node_modules/systemjs/dist/system.src.js', instrument: false},
{pattern: 'node_modules/systemjs/dist/system-polyfills.js', instrument: false},
{pattern: 'node_modules/core-js/client/shim.js', instrument: false},
{pattern: 'node_modules/zone.js/dist/zone.js', instrument: false},
{pattern: 'node_modules/zone.js/dist/long-stack-trace-zone.js', instrument: false},
{pattern: 'node_modules/zone.js/dist/proxy.js', instrument: false},
{pattern: 'node_modules/zone.js/dist/sync-test.js', instrument: false},
{pattern: 'node_modules/zone.js/dist/jasmine-patch.js', instrument: false},
{pattern: 'node_modules/zone.js/dist/async-test.js', instrument: false},
{pattern: 'node_modules/zone.js/dist/fake-async-test.js', instrument: false},
{pattern: 'src/demo/systemjs.config.js', instrument: false},
{pattern: 'src/demo/systemjs-angular-loader.js', instrument: false, load: false},
{pattern: 'src/**/*.spec.ts', ignore: true},
{pattern: 'src/**/*.ts', load: false},
{pattern: 'src/**/*.html', load: false},
{pattern: 'src/**/*.scss', load: false}
],
tests: [
{pattern: 'src/**/*.spec.ts', load: false}
],
compilers: {
'**/*.ts?(x)': wallaby.compilers.typeScript(compilerOptions)
},
middleware: (app, express) => {
app.use('/node_modules', express.static(require('path').join(__dirname, 'node_modules')));
},
env: {
kind: 'chrome'
},
testFramework: 'jasmine',
debug: true,
setup: function (wallaby) {
wallaby.delayStart();
System.config({
transpiler: false,
packages: {
'src/lib': {
defaultExtension: 'js',
meta: {
'./*.js': {
loader: 'src/demo/systemjs-angular-loader.js'
}
}
}
},
// Assume npm: is set in `paths` in systemjs.config
// Map the angular testing umd bundles
map: {
'@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
'@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
'@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
'@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
'@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
'@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
'@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js',
'@angular/forms/testing': 'npm:@angular/forms/bundles/forms-testing.umd.js',
},
});
var promises = [
Promise.all([
System.import('@angular/core/testing'),
System.import('@angular/platform-browser-dynamic/testing')
])
.then(function (providers) {
var coreTesting = providers[0];
var browserTesting = providers[1];
coreTesting.TestBed.initTestEnvironment(
browserTesting.BrowserDynamicTestingModule,
browserTesting.platformBrowserDynamicTesting());
})
];
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);
});
}
};
};