Right now my team is running protractor/jasmine-node for acceptance tests, and karma/jasmine for unit tests.
It's possible, and it has happened, that someone pushes code with iit or ddescribe for protractor/jasmine-node tests, and fit or fdescribe with karma/jasmine tests. Doing this forces jasmine to only run those tests, skipping all other tests. This is useful for debugging, however if someone forgets to revert these changes and pushes this code to our continuous integration server (Jenkins), I'd like our CI jobs to fail, since it's possible that there are broken tests that were skipped.
Is there any command-line flag or config setting I can pass to karma.conf.js or protractor.conf.js that will force all tests to run, so that our CI box doesn't skip any tests?
I guess this question is a two-parter, for both karma/jasmine and protractor/jasmine-node. Any help is appreciated.
My versions:
"jasmine-core": "^2.3.4",
"karma": "~0.12",
"karma-jasmine": "^0.3.5",
"protractor": "^2.1.0",
"jasmine-node": "~1.14.5",
Don't try to get around the symptoms, but fix the root problem instead - the fact that focused tests were actually committed into the repository is the initial problem.
We've solved it using static code analysis and ESlint
- there is a specific ESlint
plugin - eslint-plugin-jasmine
that aside from other different checks would warn you if you have left fdescribe
, fit
, ddescribe
, iit
, xdescribe
or xit
.
We've also added a git pre-commit hook (with the help of pre-git
) that runs the ESlint
and would not let a commit to go through if there are lint errors.