forked from google/traceur-compiler
-
Notifications
You must be signed in to change notification settings - Fork 3
/
testRunner.html
53 lines (52 loc) · 1.75 KB
/
testRunner.html
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
<!DOCTYPE html>
<title>Traceur Tests</title>
<meta charset="utf-8">
<link rel="stylesheet" href="./node_modules/mocha/mocha.css">
<style>
#mocha-stats.unitTestProgress {
top: 60px;
}
</style>
<script src="node_modules/mocha/mocha.js"></script>
<script src="node_modules/chai/chai.js"></script>
<script src="bin/traceur.js"></script>
<script>
window.System = new traceur.runtime.BrowserTraceurLoader();
System.map = System.semverMap(System.version);
</script>
<div id="mocha"></div>
<script>
function fixupMocha(mochaClass) {
document.getElementById('mocha-stats').classList.add(mochaClass);
}
// Unit tests
var metadata = {traceurOptions: {sourceMaps: true}};
System.import('./test/unit/unitTestRunner.js', metadata).then(function(module) {
var unitTestRunner = module.unitTestRunner;
window.suite = module.suite;
window.test = module.test;
window.setup = module.setup;
window.teardown = module.teardown;
return unitTestRunner.run().then(function() {
console.log('unitTestRunner success');
fixupMocha('unitTestProgress');
}, function(ex) {
document.getElementById('mocha').textContent = ex.stack || ex;
console.error('unitTestRunner.run FAILED', ex.stack || ex);
});
}).then(function() {
// Feature tests.
return System.import('./test/featureTestRunner.js ', metadata).
then(function(module) {
module.featureTestRunner.run().then(function() {
console.log('featureTestRunner success');
}, function(ex) {
document.getElementById('mocha').textContent = ex.stack || ex;
console.error('featureTestRunner.run FAILED', ex.stack || ex);
});
});
}).catch(function(ex) {
document.getElementById('mocha').textContent = ex.stack || ex;
console.error('import FAILED', ex.stack || ex);
});
</script>