Some way of not displaying skipped or filtered tests in the spec test reporter
What is the problem this feature will solve?
In jsdom, we have 4187 tests. Sometimes I would like to run only a few of them, so I experimented with --test-name-pattern="dom/events" to only run tests under my dom/events suite.
The result was that I saw 4100+ lines of skipped tests, within which there was somewhere buried ~50 lines of passing tests. This was not a great experience.
Compare this with Mocha, where using --fgrep="dom/events" only reports tests that match the pattern.
What is the feature you are proposing to solve the problem?
I see basically two ways to solve this:
-
Treat filtered-out tests differently from skipped tests. For example, the totals displayed at the bottom of the test report could exclude filtered-out tests entirely. (This is how Mocha behaves.)
-
Provide some way of not displaying skipped tests when using the spec reporter. E.g.,
--test-show-skipped=falseor something.
The former would be better for me, because sometimes I actually have tests marked as long-term skipped, and I'd like to see those even when I'm filtering. E.g. if I have 50 dom/events tests, of which 3 are skipped, running with --test-name-pattern="dom/events" would ideally show 47 passes and 3 skipped. If we filtered away all skipped tests, then it would show only the 47 passes.
The latter would probably be easier to implement, and fit better with how the test runner currently works.
What alternatives have you considered?
I could write my own reporter, I guess.
@nodejs/test_runner not displaying filtered out tests seems reasonable to me wdyt?
I think filtering tests and running only test is currently broken in node:test. we have a few issues discussing that https://github.com/nodejs/node/pull/48932#:~:text=Fixes%3A-,%2347945,-this%20PR%20is
Should it not be displayed only in the spec reporter?
@nodejs/test_runner this PR breaks the test_runner testing.
The tests kept failing in my development for #52529, and I could not figure out why. This PR removes the assignment to the skip variable, which, along with being responsible for the output of the test skip reason, is also responsible for the skipping of tests itself:
if (skip) {
fn = noop;
}
In my development, I've resolved this change, and it will be in #52529.
I apologize for my oversight, the information in that comment is incorrect. I'm sorry.