diff --git a/tap2junit/__main__.py b/tap2junit/__main__.py index 2f30a4d..8250e86 100644 --- a/tap2junit/__main__.py +++ b/tap2junit/__main__.py @@ -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) diff --git a/tap2junit/tap13.py b/tap2junit/tap13.py index 5d6cbe2..8cb4d6a 100644 --- a/tap2junit/tap13.py +++ b/tap2junit/tap13.py @@ -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): diff --git a/test/fixtures/test-nested.tap b/test/fixtures/test-nested.tap index d9af80f..9abc19b 100644 --- a/test/fixtures/test-nested.tap +++ b/test/fixtures/test-nested.tap @@ -25,6 +25,8 @@ TAP version 13 code: 'ERR_TEST_FAILURE' stack: |- process.emit (node:events:513:28) + (node:events:51:28) + (node:events:512:28) ... 1..2 not ok 3 - nested diff --git a/test/output/test-nested.xml b/test/output/test-nested.xml index 2d16642..81804e7 100644 --- a/test/output/test-nested.xml +++ b/test/output/test-nested.xml @@ -5,24 +5,12 @@ - ---- -code: ERR_TEST_FAILURE -duration_ms: 2.332323873 -error: Promise resolution is still pending but the event loop has already resolved -failureType: cancelledByParent -... - + process.emit (node:events:513:28) +<anonymous> (node:events:51:28) +<anonymous> (node:events:512:28) - ---- -code: ERR_TEST_FAILURE -duration_ms: 2.367870901 -error: Promise resolution is still pending but the event loop has already resolved -failureType: fail -... - + process.emit (node:events:513:28) ['# Subtest: top level 4']