Skip to content

Commit

Permalink
fix missing stack property
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Mar 23, 2024
1 parent 5f90621 commit e1c8753
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion tap2junit/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def map_yaml_to_junit(test):
raw_yaml = f"\n{yamlish.dumps(yaml)}" if yaml else ""
err_code = yaml.get("exitcode", 0)
err_severity = yaml.get("severity", "")
err_output = yaml.get("stack", "") or raw_yaml
err_output = raw_yaml
error_message = yaml.get("message", "") or f"{err_severity} ({err_code})"
if err_code < 0 or err_severity == "crashed":
t.add_error_info(error_message, err_output, err_code)
Expand Down
3 changes: 2 additions & 1 deletion tap2junit/tap13.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ def __init__(self):
def _parse_yaml(self, line, in_yaml, in_yaml_block):
indentation = len(line) - len(line.lstrip())
if in_yaml_block and indentation > self.tests[-1]._yaml_block_indentation:
self.tests[-1]._yaml_buffer.append(line.rstrip())
return in_yaml, in_yaml_block
elif RE_YAML_BLOCK.match(line):
elif not in_yaml and RE_YAML_BLOCK.match(line):
self.tests[-1]._yaml_block_indentation = indentation
in_yaml_block = True
elif RE_YAMLISH_END.match(line):
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/test-nested.tap
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ TAP version 13
code: 'ERR_TEST_FAILURE'
stack: |-
process.emit (node:events:513:28)
<anonymous> (node:events:51:28)
<anonymous> (node:events:512:28)
...
1..2
not ok 3 - nested
Expand Down
20 changes: 4 additions & 16 deletions test/output/test-nested.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,12 @@
<testcase name="- top level 2" time="0.000303"/>
<testcase name="- nested 1" time="0.002368"/>
<testcase name="- nested 2" time="0.002332">
<failure type="failure" message=" (0)">
---
code: ERR_TEST_FAILURE
duration_ms: 2.332323873
error: Promise resolution is still pending but the event loop has already resolved
failureType: cancelledByParent
...
</failure>
<failure type="failure" message=" (0)">process.emit (node:events:513:28)
&lt;anonymous&gt; (node:events:51:28)
&lt;anonymous&gt; (node:events:512:28)</failure>
</testcase>
<testcase name="- nested" time="0.002368">
<failure type="failure" message=" (0)">
---
code: ERR_TEST_FAILURE
duration_ms: 2.367870901
error: Promise resolution is still pending but the event loop has already resolved
failureType: fail
...
</failure>
<failure type="failure" message=" (0)">process.emit (node:events:513:28)</failure>
<system-err>['# Subtest: top level 4']</system-err>
</testcase>
<testcase name="- top level 4" time="0.000341"/>
Expand Down

0 comments on commit e1c8753

Please sign in to comment.