node icon indicating copy to clipboard operation
node copied to clipboard

`<undefined>` node and incorrect nesting of testsuites in `junit` test report

Open adrienjoly opened this issue 1 year ago • 2 comments

Version

21.6.1

Platform

linux-x64 (github actions runner), ubuntu 22.04.3

Subsystem

junit test reporter

What steps will reproduce the bug?

I was not able to reproduce, unfortunately.

But here's the command that ran in CI:

xvfb-run node --test \
    --test-timeout 240000 \
    --test-shard=[3](__CI_JOB_URL__)/8 \
    --test-reporter=junit --test-reporter-destination=3.junit.xml \
    --test-reporter=spec --test-reporter-destination=stdout \
    'packages/A/test/**/*.test*.js' \
    'packages/B/test/**/*.test*.js'

And, in practice:

  • 4 different test files were listed in spec's report summary
  • these 4 test files ended up timing out
  • and some of their test failed

How often does it reproduce? Is there a required condition?

It happened once.

What is the expected behavior? Why is that the expected behavior?

  • see 4 instead of 2, in the "suites" part of the summary
  • see each test file listed directly under the root <testsuites> node of the junit report
  • no see any <undefined> node in the junit report

What do you see instead?

This junit report:

<?xml version="1.0" encoding="utf-8"?>
<testsuites>
    <undefined name="Test suite from package A">
        <testcase
            name="xxx"
            time="192.141114" classname="test" />
        <testcase name="packages/a/test/xxx.js"
            time="240.004743" classname="test" failure="test timed out after 240000ms">
            <failure type="testTimeoutFailure" message="test timed out after 240000ms">
                [Error [ERR_TEST_FAILURE]: test timed out after 240000ms] { code:
                'ERR_TEST_FAILURE', failureType: 'testTimeoutFailure', cause: 'test timed out after
                240000ms' }
            </failure>
        </testcase>
        <undefined name="Test suite from package B">
            <testsuite name="yyy" time="20.474488" disabled="0" errors="0"
                tests="2" failures="0" skipped="0" hostname="fv-az351-556">
                <testcase
                    name="zzz"
                    time="14.748208" classname="test" />
            </testsuite>
            <!-- 'only' and 'runOnly' require the &#45;&#45;test-only command-line option. -->
            <undefined name="Nested describe block from that test suite">
                <testcase
[...]

These spec logs:

ℹ tests 20
ℹ suites 2
ℹ pass 10
ℹ fail 4
ℹ cancelled 4
ℹ skipped 2
ℹ todo 0
ℹ duration_ms 960072.029887

✖ failing tests:

test at packages/a/test/a.test.js:1:1
✖ packages/functional-tester/test/a.test.js (240004.742945ms)
  'test timed out after 240000ms'

test at packages/b/test/executeAction/b1.test.js:1:1
✖ packages/b/test/executeAction/b1.test.js (240002.364515ms)
  'test timed out after 240000ms'

test at file:packages/b/test/b2.test.js:19:9
✖ xxx (31485.676502ms)

test at packages/b/test/b2.test.js:1:1
✖ packages/b/test/b2.test.js (240001.953746ms)
  'test timed out after 240000ms'

test at file:packages/b/test/b3.test.js:43:9
✖ xxx (207955.076ms)

test at file:packages/b/test/b3.test.js:55:9
✖ yyy (71185.942777ms)

test at file:packages/b/test/b3.test.js:63:9
✖ zzz (38479.[536](__CI_JOB_URL__#step:9:537)748ms)

test at packages/b/test/b3.test.js:1:1
✖ packages/b/test/b3.test.js (240002.103949ms)
  'test timed out after 240000ms'

Additional information

No response

adrienjoly avatar Feb 09 '24 09:02 adrienjoly

Thanks for reporting! can you provide a minimal repro?

marco-ippolito avatar Feb 09 '24 09:02 marco-ippolito

I tried, but unfortunately I was not even able to reproduce the problem with the actual tests…

I’m guessing that looking from where that « undefined » comes could be a good track to follow.

adrienjoly avatar Feb 09 '24 10:02 adrienjoly

I think we should close this pending a reproduction.

cjihrig avatar Mar 15 '24 13:03 cjihrig

No follow up and no way of reproducing the problem. I'm going to close this. If anyone finds a repro, feel free to comment here and we can revisit this.

cjihrig avatar Mar 24 '24 14:03 cjihrig