My unit tests are contained into a module that loads from an HTML page using SystemJS.
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
<script src="node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
<script src="node_modules/jasmine-core/lib/jasmine-core/boot.js"></script>
<script>
System.config({
defaultJSExtensions: true,
map: {
"angular2": 'http://localhost:8000/angular2',
"rxjs": 'node_modules/rxjs'
},
packages: {
angular2: {
defaultExtension: 'js',
}
}
});
System.import('angular2/test/http/backends/xhr_backend_spec')
.then((src) => {
src.main();
});
</script>
My page doesn't display any tests whereas my main
method contains a test suite:
export function main() {
console.log('in main');
describe('XHRBackend', () => {
(...)
});
}
I put some traces and I check that the main
function and the callback defined in the describe function are called. But the tests themselves aren't executed within the describe
callback.
I guess that I need to wait for the module to be loaded before running Jasmine but I don't know how to configure this.
Thanks for your help!