Skip to content
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

Add --fail-skip/todo opts, better skip reporting #901

Merged
merged 2 commits into from Sep 19, 2023
Merged

Conversation

isaacs
Copy link
Member

@isaacs isaacs commented Sep 18, 2023

This reports 'no tests found' as the skip reason for any test that does
not have a parent (so, typically, just the root TAP test) and also emits
no tests with a 1..0 plan, even if it lacks a skipReason in the plan.

Also, if failSkip is set in the test options (defaulting to
env.TAP_FAIL_SKIP in the root test) then any skipped test points will
be treated as failures. Ditto todo tests with failTodo.

This makes it possible to run tap --fail-skip --fail-todo -s todo.txt
to easily work through a backlog of skipped tests.

Second commit adds --filter-quietly, which defaults to true when --fail-skip is set, making it possible to use --fail-skip along with --grep and --only without a ton of noise.

Fix: #892

This reports 'no tests found' as the skip reason for any test that does
not have a parent (so, typically, just the root TAP test) and also emits
no tests with a 1..0 plan, even if it lacks a skipReason in the plan.

Also, if `failSkip` is set in the test options (defaulting to
`env.TAP_FAIL_SKIP` in the root test) then any skipped test points will
be treated as failures. Ditto todo tests with `failTodo`.

This makes it possible to run `tap --fail-skip --fail-todo -s todo.txt`
to easily work through a backlog of skipped tests.

Doesn't exactly play nicely with --grep and --only, but it's hard to
know what to do in that case. You're telling tap that you want to fail
if any tests are skipped, and also telling it to skip tests. It seems
reasonable to assume that you don't want it to fail for tests skipped
with --grep or --only, since it should be as if those tests just didn't
*exist*, so probably going to need to figure out another way to signal
this.

Fix: #892
This makes it possible to use `--grep` and `--only` along with
`--fail-skip`, without making a ton of excessive noise. If you *want*
`--fail-skip` to fail on filtered tests, then you can set
`--no-filter-quietly` to force the skip messages.

Also, it's kind of nicer when filtering tests anyway, because it
provides a way to not have them show a bunch of noisy repetitive skip
messages.
@isaacs isaacs merged commit e42ea1a into main Sep 19, 2023
6 checks passed
@isaacs isaacs deleted the isaacs/fail-skip-todo branch September 19, 2023 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add options to treat todo/skip as failures
1 participant