question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to fail if there are skipped tests

See original GitHub issue

🚀 Feature Proposal

Add a CLI option to fail if there are any skipped tests. This option would be a boolean, possibly called disallowSkipping, or something like this.

Motivation

Skipping tests is really useful when maintaining tests, however, sometimes, a skipped test may be committed and pushed to the repository.

It’d be really useful if there was a CLI argument to fail the tests if there are any skipped tests. This argument would then be configured in the hooks and possibly in the CI to ensure all tests are running.

Example

$ jest --disallowSkipping

Pitch

Recently we had a test flagged with .only finding its way all the way to the develop branch because the developer committed the test file with it. We then had two other developers, including myself, reviewing that PR and also we didn’t realise that only that test case was being run for the whole file. Of course that was an oversight on our end, but we’re all subject to pressure to deliver.

Much to my surprise, there isn’t any options to disallowing skipped test cases or to ignore skipping altogether. Although there might be arguments for both cases, I believe to be cleaner to fail the tests if there are any being skipped than to ignore skipping because it’d force the code owner to actually fix the commit and remove the skip rule.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
scotthovestadtcommented, Apr 13, 2019

This type of feature is best implemented as a lint rule; and already has been.

no focused tests: https://github.com/jest-community/eslint-plugin-jest/blob/master/docs/rules/no-focused-tests.md

a variety of other rules: https://github.com/jest-community/eslint-plugin-jest/blob/master/docs/rules/

0reactions
github-actions[bot]commented, May 11, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I let skipped tests fail in jest? - Stack Overflow
Skipped tests are marked "skipped" for a reason and should not trigger a "fail". The simplest solution to your problem would be to...
Read more >
Maven Failsafe Plugin – Skipping Tests
To skip running the tests for a particular project, set the skipITs property to true. ... You can also skip the tests via...
Read more >
How to use skip and xfail to deal with tests that cannot succeed
A skip means that you expect your test to pass only if some conditions are met, otherwise pytest should skip running the test...
Read more >
Skipped tests should not mark build as UNSTABLE
This is how the junit results work. I think it makes more sense this way. If a test developer wants a build to...
Read more >
How to run, ignore or skip Jest tests, suites and files
When debugging or writing units tests with Jest it can be useful to specify a single file or test to run or to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found