forked from MrSwitch/hello.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtesting.js
59 lines (47 loc) · 1.26 KB
/
testing.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
/**
* Run tests on the HelloJS service
*/
//var assert = chai.assert;
//var should = chai.should();
mocha.setup('bdd');
mocha.setup({ignoreLeaks:true});
var tests = [];
for (var file in window.__karma__.files) {
if (window.__karma__.files.hasOwnProperty(file)) {
if (/\.js$/.test(file)) {
tests.push(file);
}
}
}
//
/*
var previous_load = window.requirejs.load;
window.requirejs.load = function(context, moduleName, url){
if(! /^\.js(\?|$)/.test(url)){
url = url.replace(/(\/[^\?\/]+)(?!\.js)(\?|$)/, '$1.js$2');
}
previous_load.call(this, context, moduleName, url);
};
/**/
console.log(tests);
requirejs.config({
// Karma serves files from '/base'
baseUrl: '/base/src',
// ask Require.js to load these files (all our tests)
deps: tests,
// start test run, once Require.js is done
callback: window.__karma__.start
});
//mocha.setup({globals: [/^_hellojs_/]});
/*
jasmine.Matchers.prototype.toBeTypeOf = function(expected) {
var actual, notText, objType;
actual = this.actual;
notText = this.isNot ? 'not ' : '';
objType = actual ? Object.prototype.toString.call(actual) : '';
this.message = function() {
return 'Expected ' + actual + notText + ' to be an array';
};
return objType.toLowerCase() === '[object ' + expected.toLowerCase() + ']';
};
*/