Reputation: 313
I feel like I have tried everything. The files are found, even the simplest tests won't run. I show this:
Chrome 49.0.2623 (Windows 7 0.0.0): Executed 0 of 0 SUCCESS (0 secs / 0 secs)
Chrome 49.0.2623 (Windows 7 0.0.0): Executed 0 of 0 ERROR (0.003 secs / 0 secs)
I feel like I've tried everything. I've tried different frameworks, Mocha/Chai - Jasmine, nothing. The debug tab doesn't show anything in chrome when I click it.
Project Dir: http://pastebin.com/1wQubhCt
karma.shim.js: http://pastebin.com/PtPnL82G
karma.conf.js: http://pastebin.com/CU0aqnj6
Example test (obviously expect to fail):
import {
it,
expect,
describe,
beforeEachProviders
} from 'angular2/testing';
describe('myComponent', () => {
beforeEachProviders([]);
describe('creation', () => {
it('should do this', ()=> {
expect(1).toEqual(2)
})
});
});
Upvotes: 0
Views: 500
Reputation: 4021
For me this issue was resolved by updating the Angular-CLI:
npm install --save-dev @angular/cli@latest
Upvotes: 0
Reputation: 202138
Running tests within Karma can be a bit painful because of the karma.shim.js
file. Most of time the problem is in this file.
I think that there is a problem in this file and more particularly in the onlySpecFiles
function. This should be /_test\.js$/
instead of /_test\.ts$/
:
function onlySpecFiles(path) {
return /_test\.ts$/.test(path);
}
You could see this question for more details:
Upvotes: 0
Reputation: 39248
At this point I recommend using Angular CLI when setting up an angular 2.0 project from scratch. It gives you a functional unit test runner and auto reloading for the website whenever you make a code change.
It removes all the tedious configuration steps you have to go through to set up the project.
Check it out here: https://github.com/angular/angular-cli
Upvotes: 1