-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest-main.js
68 lines (59 loc) · 1.58 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// HACK: add .js file extension if missing in requirejs
var previous_load = window.requirejs.load;
window.requirejs.load = function(context, moduleName, url) {
if(!/\.js$/.test(url)) {
url += ".js"
}
previous_load.call(this, context, moduleName, url);
};
var allTestFiles = [];
var TEST_REGEXP = /test\.js$/;
Object.keys(window.__karma__.files).forEach(function(file) {
if (TEST_REGEXP.test(file)) {
// Normalize paths to RequireJS module names.
allTestFiles.push(file
.replace(/^\/base\//, 'http://localhost:9876/base/')
//.replace(/\.js$/, '')
);
}
});
console.log("TEST FILES in require config:");
allTestFiles.forEach(function(file) {
console.log(file);
});
require.config({
//urlArgs: "bust=" + (new Date()).getTime(),
// Karma serves files under /base, which is the basePath from your config file
baseUrl:
// '',
'http://localhost:9876/base/lib',
// changed from '/base'
// example of using a couple path translations (paths), to allow us to refer to different library dependencies, without using relative paths
/*
paths: {
'jquery': '../lib/jquery',
'underscore': '../lib/underscore',
},
*/
packages: [
/* {
name: 'jello',
location: 'physics',
main: 'jello'
}*/
],
// example of using a shim, to load non AMD libraries (such as underscore)
/*
shim: {
'underscore': {
exports: '_'
}
},
*/
// web server port
port: 9876,
// dynamically load all test files
deps: allTestFiles,
// we have to kickoff jasmine, as it is asynchronous
callback: window.__karma__.start
});