Repository navigation
Built-in test module only report ouput of the first top level describe #46478
Description
Version
v19.4.0
Platform
Linux AVRAST1790 5.19.0-30-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 6 15:40:20 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
test
What steps will reproduce the bug?
On a test file with multiple top level describe, report output only show the first one of them that got run. Any other describe gets no reported nor counted, both passing or failing. In fact, final report don't provide correct statistics at all:
TAP version 13
# Subtest: /home/piranna/Trabajo/Avrioc/EsDiPi/test/cli.js
# longestStatic: 36
# length: 85917
# Subtest: clean-sdp
ok 1 - clean-sdp # SKIP
---
duration_ms: 2.336453
...
# Subtest: compress
ok 2 - compress # SKIP
---
duration_ms: 0.057482
...
# Subtest: empty esdipi
ok 3 - empty esdipi
---
duration_ms: 5.970628
...
# Subtest: Offer esdipi
ok 4 - Offer esdipi
---
duration_ms: 21.166008
...
# Subtest: Answer esdipi
ok 5 - Answer esdipi
---
duration_ms: 9.956793
...
1..8
ok 1 - /home/piranna/Trabajo/Avrioc/EsDiPi/test/cli.js
---
duration_ms: 104.264871
...
1..1
# tests 1
# pass 1
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 106.675893It should be showing 11 total tests, passing 4 (3 from "empty esdipi" describe and another top level one not shown), 6 skipped ones from the "clean-sdp" and "compress" describes, and 1 failed top level one not shown.
If there are other skipped describes, they are shown as skipped, but there's no info of any other describe or test defined it. In fact, if I have tests after that describe, they get run (checked with c8 coverage, code being tested by that tests gets covered) but their status is not reported at all, both failed or sucessful. If I move one of that test that's passing to be executed before the describes, lefting one test that's failing to execute after the describes, then the first test and all the describes (including the skipped ones) fails with the next error and don't get executed at all:
not ok 2 - clean-sdp # SKIP
---
duration_ms: 0
failureType: 'cancelledByParent'
error: 'Promise resolution is still pending but the event loop has already resolved'
code: 'ERR_TEST_FAILURE'
stack: |-
process.emit (node:events:512:28)
...It seems like the test module has been tested or is more indented to have a single top level describe or test entry, not allowing to have several ones.
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
All describes and tests are being executed and reported, both passing and failing ones, no matter of their order of if they are inside describe / sub-tests.
What do you see instead?
Only first describe / sub-test is being reported, any other top level test or describe are excluded from reports.
Additional information
It seems there are several inter-related errors on this issue.
Activity
MoLow commentedon Feb 4, 2023
please include the file you are running and the cli command
piranna commentedon Feb 7, 2023
I have uploaded my project to https://github.com/piranna/ESDiPi, and the actual file with the tests are at https://github.com/piranna/ESDiPi/blob/main/test/cli.js, you can play with them reordering or skipping them and will have the same behaviour I have. Module itself is working properly, so tests should not give you problems, just only the Node.js
testtests runner module.MoLow commentedon Feb 7, 2023
@piranna the issue is the usage of
describewithtest.describeis supposed to be used withitonly - which I hope will be fixed/changed,but in the meanwhile you can change you code from
testtoitpiranna commentedon Feb 7, 2023
Aren't they aliases between them? At least it's the feel it gives on the docs (not that it says it, it's just a feeling) and the same for
describe()...MoLow commentedon Feb 7, 2023
they are not aliases, but I agree it is a fair expectation for
testto work the same wayitdoes, thus I opened a PR to change the behavior #46544piranna commentedon Feb 7, 2023
Thank you :-)
piranna commentedon Feb 7, 2023
Thank you :-)
piranna commentedon Feb 10, 2023
I confirm that with
itinstead oftest, all tests and describes runned :-) Just only, the global metrics are still wrong:I think with these tests output report they should be
Maybe that should be another issue?
cjihrig commentedon Feb 10, 2023
That's being handled in #46440.
piranna commentedon Feb 10, 2023
Cool, thank you for the pointer :-)
test_runner: allow nesting test within describe
test_runner: allow nesting test within describe
test_runner: allow nesting test within describe
test_runner: allow nesting test within describe
test_runner: allow nesting test within describe
test_runner: allow nesting test within describe