Skip to content

ValueError: Descending test id on line ... #50

@ForbiddenEra

Description

@ForbiddenEra

Trying to use this to convert the tap output from the built-in test runner to junit for CI/CD use.

# ~/.local/bin/tap2junit -i tests/report.txt -o tests/report.xml
Traceback (most recent call last):
  File "~/.local/bin/tap2junit", line 8, in <module>
    sys.exit(main())
  File "~/.local/pipx/venvs/tap2junit/lib/python3.8/site-packages/tap2junit/__main__.py", line 94, in main
    convert(
  File "~/.local/pipx/venvs/tap2junit/lib/python3.8/site-packages/tap2junit/__main__.py", line 68, in convert
    result = parse(name or input_file, data, package)
  File "~/.local/pipx/venvs/tap2junit/lib/python3.8/site-packages/tap2junit/__main__.py", line 58, in parse
    tap_parser.parse(data)
  File "~/.local/pipx/venvs/tap2junit/lib/python3.8/site-packages/tap2junit/tap13.py", line 238, in parse
    self._parse(io.StringIO(source))
  File "~/.local/pipx/venvs/tap2junit/lib/python3.8/site-packages/tap2junit/tap13.py", line 193, in _parse
    raise ValueError("Descending test id on line: %r" % line)
ValueError: Descending test id on line: 'ok 1 - fileSize checks'

report.txt (as outputted from node --test-reporter=tap --test-reporter-destination=report.txt tests/run-tests.js)

TAP version 13
# Subtest: System Configuration Required Tests
ok 1 - System Configuration Required Tests # TODO System Configuration Required Tests
  ---
  duration_ms: 3.723
  ...
# Subtest: System Configuration Optional Tests
    # Subtest: System Configuration Optional Tests
    ok 1 - System Configuration Optional Tests
      ---
      duration_ms: 3.2683
      ...
    1..1
ok 2 - System Configuration Optional Tests
  ---
  duration_ms: 4.5664
  ...
# Subtest: Main Validation Tests
    # Subtest: fileSize checks
        # Subtest: fileSize is too small
        ok 1 - fileSize is too small
          ---
          duration_ms: 20.9785
          ...
        # Subtest: fileSize is too large
        ok 2 - fileSize is too large
          ---
          duration_ms: 27.1384
          ...
        1..2
    ok 1 - fileSize checks
      ---
      duration_ms: 51.8895
      ...
    1..1
ok 3 - Main Validation Tests
  ---
  duration_ms: 53.4117
  ...
1..3
# tests 3
# pass 2
# fail 0
# cancelled 0
# skipped 0
# todo 1
# duration_ms 81.1599

Not entirely sure why this is happening but if I had to guess it's nesting depth/recursion related..?

If I take out the fileSize checks wrapping around those tests, it seems to work..

There's no issues anywhere else, even with the built-in experimental node test runner (a previous version of node gave bad output when nesting hit the third level, but on latest [v19.8.1] the TAP output looks correct to me and is parsed and handled fine by other tools such as tap itself) so I'd rather not lose the 'nice' grouping of the tests just to get a junit XML file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions