-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest-main.js
46 lines (39 loc) · 1.22 KB
/
test-main.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
var allTestFiles = [];
var TEST_REGEXP = /(Spec)\.js$/;
var pathToModule = function (path) {
return path.replace(/^\/base\//, '').replace(/\.js$/, '');
};
Object.keys(window.__karma__.files).forEach(function (file) {
if (TEST_REGEXP.test(file)) {
// Normalize paths to RequireJS module names.
allTestFiles.push(pathToModule(file));
}
});
require.config({
// Karma serves files from the basePath defined in karma.conf.js
baseUrl: '/base',
paths: {
lodash: 'bower_components/lodash/lodash.min',
moment: 'bower_components/moment/moment',
uuid: 'bower_components/node-uuid/uuid',
saveAs: 'bower_components/FileSaver.js/FileSaver.min',
html2canvas: 'bower_components/html2canvas/build/html2canvas.min'
},
map: {
vista: {
uuid: 'bower_components/node-uuid/uuid'
}
},
// dynamically load all test files
deps: allTestFiles,
// we have to kickoff jasmine, as it is asynchronous
callback: function () {
var args = [].slice.apply(arguments);
require(['node_modules/es6-promise/dist/es6-promise'], function (es6Promise) {
if (!window.Promise) {
window.Promise = es6Promise.Promise;
}
window.__karma__.start.apply(window.__karma__, args);
});
}
});