I'm running Jasmine tests in SystemJS+Typescript environment (basically a plunk that is supposed to be Angular 2 test rig).
Jasmine is intentionally used as global library, not via TypeScript import
.
This results in
No specs found
There are no errors in console, the specs just don't run:
main.ts
describe('test', () => {
it('test', () => {
console.log('test');
expect(1).toBe(1);
});
});
I'm positive this is due to the fact that main.ts
is loaded asynchronously with SystemJS, so Jasmine boot procedure should be additionally triggered in order to make it pick on the specs.
The manual describes what is default boot configuration in Jasmine, but it doesn't explain well how it can boot be executed manually.
What is the way to run the tests with SystemJS and global Jasmine in this case?
The reason is that your specs are loaded after jasmine
has done attempts to search and execute them.
To overcome this issue you can call window.onload
again after your specs are loaded by system.js
:
<script>
System.import('app').then(window.onload).catch(console.error.bind(console));
</script>