forked from LivelyKernel/lively4-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-main.template.js
68 lines (58 loc) · 2.1 KB
/
test-main.template.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
focalStorage.setItem("githubToken", "INSERTGITHUBTOKEN").then(function(){
var allTestFiles = [];
var TEST_REGEXP = /(spec|test)\.js$/i;
// Get a list of all the test files to include
Object.keys(window.__karma__.files).forEach(function(file) {
if (TEST_REGEXP.test(file)) {
// Normalize paths to RequireJS module names.
// If you require sub-dependencies of test files to be loaded as-is (requiring file extension)
// then do not normalize the paths
var normalizedTestModule = file.replace(/^\/base\/|\.js$/g, '');
allTestFiles.push(normalizedTestModule);
console.log('Loaded Test: ' + normalizedTestModule);
}
});
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/serviceworker-loader.js', {
scope: "http://localhost:9876/"
}).then(function(registration) {
// Registration was successful
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}).catch(function(err) {
// registration failed
console.log('ServiceWorker registration failed: ', err);
});
}
navigator.serviceWorker.ready.then(function() {
"use strict";
navigator.serviceWorker.onmessage = function(event) {
if (event.data.meta && event.data.meta.type == 'broadcast') {
console.log(event.data.message);
}
};
/*
Promise.all(allTestFiles.map(function (file) {
console.log('Load Test File: ' + file);
return System.import('base/' + file + '.js');
})).then(function() {
console.log("STAAAAAAAAAAAAAARRRRRRRRRRTTTTT!!!!!!");
window.__karma__.start();
console.log("EEEEEEENNNNNNNNNNNNNNNNNNNDDDD!!!!!!");
});
return;
*/
try {
console.log("REQUIRE=" + require)
} catch(e) {
console.log("ERROR:", e)
}
require.config({
// Karma serves files under /base, which is the basePath from your config file
baseUrl: '/base',
// dynamically load all test files
deps: allTestFiles,
// we have to kickoff jasmine, as it is asynchronous
callback: window.__karma__.start
});
});
})