-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to fail on skipped tests #3284
Comments
This is a job for a karma 'reporter', that is a plugin that monitors test results. The reporter can set a flag when a spec is skipped, see eg |
I took a closer look and I can see how I can figure out skipped tests from the browsers argument in the reporter. This means that I would need to write my reporter which is doable. I was trying this in karma-spec-reporter/index.js onRunComplete:
Running output:
Then in console I can see the exit code:
This would be a bit simpler if the 'results' object stored the count of skipped tests but it doesn't:
|
I'm a bit confused: it looks like |
This should be resolved by #3374 (4ed3af0) as thw0rted mentioned, regarding the reporting of failing on skipped tests however I think the karma infrastructure does not really allow for reporting this by itself, as karma also does not log e.g. failures on failing tests: karma/lib/browser_collection.js Lines 41 to 59 in 259be0d
Line 310 in 7a94d33
I think this could be done with a reporter tho. TLDR: Close this issue. |
This is a feature request to add ability to fail (exit with non-0 code) on skipped tests. This is to address an issue of someone accidentally using focused Jasmine tests (fdescribe/fit) and checking this into code repository.
The run then exits with:
Printing exit code:
This is needed to fail such a run in Maven which uses plugins that rely on exit code to know whether to fail the 'test' goal or not. There is no other known reliable way of providing exit status from Karma. The plugins cannot read output reports as these could be wildly different depending on which report was printed.
Line 72 in frontend-maven-plugin by eirslett:
https://github.com/eirslett/frontend-maven-plugin/blob/master/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/ProcessExecutor.java
Line 277 in maven-karma-plugin by kelveden:
https://github.com/karma-runner/maven-karma-plugin/blob/master/src/main/java/com/kelveden/karma/StartMojo.java
The feature would be similar to the option to 'failOnEmptyTestSuite' but called something like 'failOnSkippedTests'
Environment Details
Karma version (output of
karma --version
):Karma version: 3.1.4
"karma-jasmine": "^2.0.1",
"karma-phantomjs-launcher": "^1.0.4",
"karma-htmlfile-reporter": "^0.3.7",
"karma-jasmine-html-reporter": "^1.4.0",
"karma-spec-reporter": "0.0.32",
The text was updated successfully, but these errors were encountered: