angular / router

The Angular 1 Component Router
MIT License
665 stars 135 forks source link

ES5 tests not running with `npm test` #182

Open SamVerschueren opened 9 years ago

SamVerschueren commented 9 years ago

Executing npm test only runs the router.spec.ats file. For running the ES5 tests, you should start karma with another config file like this karma start karma.es5.conf.js --single-run.

Is there a reason why this isn't being tested? The router-viewport test does not complete because of a typo (https://github.com/angular/router/blob/master/test/router-viewport.es5.spec.js#L85: components should be component) and because of this error

Some of your tests did a full page reload!

Should we add another script to package.json, something like:

"test-es5": "karma start karma.es5.conf.js --single-run"

Although, that will not be executed by travis and the developer should execute 2 commands.

A better solution would be to alter the karma.es5.conf.js file to run on another port (9877 for instance) and then change the scripts property in package.json like this

{
    "test": "karma start --single-run & karma start karma.es5.conf.js --single-run"
}

Maybe there is another solution. Just suggesting...

btford commented 9 years ago

Is there a reason why this isn't being tested?

It is tested via https://github.com/angular/router/blob/master/.travis.yml

The router-viewport test does not complete because of a typo

That was a legit failure, not a typo.

I'm not sure what the local workflow should look like, but when developing a new feature with a TDD-ish methodology, I typically only run one set of tests. The task runner built in to npm is not ideal for this kind of workflow.

I'm open to suggestions, but I don't think this is a pressing issue.

SamVerschueren commented 9 years ago

Hi @btford

Thanks for the explanation. I was just being curious... I usually test everything with npm test because if someone else downloads the project, he can just run that command and see if everything still works. And if I only want to run a specific test I use the karma start karma.es5.conf.js --single-run command.