systemjs/test/test.html

70 lines
2.2 KiB
HTML

<!doctype html>
<meta charset="utf-8">
<script>
if (typeof Promise === 'undefined')
document.write('<script src="../node_modules/bluebird/js/browser/bluebird.core.js"><\/script>');
</script>
<script>
if (typeof fetch === 'undefined')
document.write('<script src="../node_modules/whatwg-fetch/fetch.js"><\/script>');
</script>
<script defer src="../node_modules/construct-style-sheets-polyfill/adoptedStyleSheets.js"></script>
<script>
// TODO IE11 URL polyfill testing
// if (typeof URL === 'undefined')
// document.write()
</script>
<link rel="stylesheet" type="text/css" href="../node_modules/mocha/mocha.css"/>
<script src="../node_modules/mocha/mocha.js"></script>
<script type="systemjs-importmap" src="fixtures/browser/importmap.json"></script>
<script type="systemjs-module" src="/test/fixtures/browser/systemjs-module-early.js"></script>
<script src="../dist/system.js"></script>
<script type="systemjs-module" src="/test/fixtures/browser/systemjs-module-script.js"></script>
<script type="systemjs-module" src="import:/test/fixtures/browser/systemjs-module-script2.js"></script>
<script>
mocha.setup('tdd');
self.baseURL = location.href.substr(0, location.href.lastIndexOf('/') + 1);
self.rootURL = location.href.substr(0, location.href.substr(0, location.href.lastIndexOf('/')).lastIndexOf('/') + 1);
self.assert = {
ok: function (val) {
this.equal(!!val, true);
},
equal: function equal(a, b) {
if (a !== b)
throw new Error('Expected "' + a + '" to be "' + b + '"');
},
fail: function (msg) {
throw new Error(msg);
}
};
const extras = ['amd', 'named-exports', 'transform', 'named-register'];
let failCnt = 0;
function runNextExtra (failures) {
failCnt += failures;
mocha.suite.suites.shift();
const extra = extras.shift();
if (extra)
System.import('../dist/extras/' + extra + '.js')
.then(function () {
return System.import('./browser/' + extra + '.js');
})
.then(function () {
mocha.run(runNextExtra);
});
else
fetch(failCnt ? '/error' : '/done');
}
System.import('./browser/core.js')
.then(function () {
mocha.run(runNextExtra);
});
</script>
<div id="mocha"></div>