Skip to content

Commit

Permalink
fix missing stack property (#54)
Browse files Browse the repository at this point in the history
* fix missing stack property

* update fixtures

* fixtures
  • Loading branch information
aduh95 authored Apr 10, 2024
1 parent 27fbbaf commit 4ddd247
Show file tree
Hide file tree
Showing 8 changed files with 506 additions and 10 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
9 changes: 7 additions & 2 deletions test/output/test-nested.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<testsuites disabled="0" errors="0" failures="2" tests="7" time="0.010541631081999998">
<testsuite disabled="0" errors="0" failures="2" name="test/fixtures/test-nested" skipped="0" tests="7" time="0.010541631081999998" hostname="{HOSTNAME}">
<testsuites disabled="0" errors="0" failures="2" tests="7" time="0.010541631082">
<testsuite disabled="0" errors="0" failures="2" name="test/fixtures/test-nested" skipped="0" tests="7" time="0.010541631082" hostname="{HOSTNAME}">
<testcase name="- top level 1" time="0.000341"/>
<testcase name="- top level 2" time="0.000303"/>
<testcase name="- nested 1" time="0.002368"/>
Expand All @@ -11,6 +11,10 @@ code: ERR_TEST_FAILURE
duration_ms: 2.332323873
error: Promise resolution is still pending but the event loop has already resolved
failureType: cancelledByParent
stack: |-
process.emit (node:events:513:28)
&lt;anonymous&gt; (node:events:51:28)
&lt;anonymous&gt; (node:events:512:28)
...
</failure>
</testcase>
Expand All @@ -21,6 +25,7 @@ code: ERR_TEST_FAILURE
duration_ms: 2.367870901
error: Promise resolution is still pending but the event loop has already resolved
failureType: fail
stack: process.emit (node:events:513:28)
...
</failure>
<system-err>['# Subtest: top level 4']</system-err>
Expand Down
70 changes: 68 additions & 2 deletions test/output/test.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<testsuites disabled="0" errors="1" failures="0" tests="2370" time="11.86254800000001">
<testsuite disabled="0" errors="1" failures="0" name="test/fixtures/test" skipped="45" tests="2370" time="11.86254800000001" hostname="{HOSTNAME}">
<testsuites disabled="0" errors="1" failures="0" tests="2370" time="11.862548">
<testsuite disabled="0" errors="1" failures="0" name="test/fixtures/test" skipped="45" tests="2370" time="11.862548" hostname="{HOSTNAME}">
<testcase name="test-crypto-randomBytes" time="0.002551" classname="async-hooks"/>
<testcase name="test-crypto-pbkdf2" time="0.003122" classname="async-hooks"/>
<testcase name="test-async-await" time="0.003518" classname="async-hooks"/>
Expand Down Expand Up @@ -939,6 +939,72 @@
duration_ms: 4.339
exitcode: -6
severity: crashed
stack: |-
DebugPrint: 0xe1d05f8a219: [JS_OBJECT_TYPE]
- map: 0x14e5844ec739 &lt;Map(HOLEY_ELEMENTS)&gt; [FastProperties]
- prototype: 0x0e1d05f958c1 &lt;Object map = 0x14e5844e9e51&gt;
- elements: 0x15574d2023b1 &lt;FixedArray[0]&gt; [HOLEY_ELEMENTS]
- properties: 0x15574d2023b1 &lt;FixedArray[0]&gt; {
#_readableState: 0x0e1d05f8a2f9 &lt;ReadableState map = 0x14e5844e7041&gt; (data field 0)
#readable: 0x15574d2029a1 &lt;false&gt; (data field 1)
#_events: 0x0e1d05f8a489 &lt;Object map = 0x14e584483a69&gt; (data field 2)
#_eventsCount: 0 (data field 3)
#_maxListeners: 0x15574d2026f1 &lt;undefined&gt; (data field 4)
#socket: 0x0e1d05f89431 &lt;Socket map = 0x14e5844ebe49&gt; (data field 5)
#connection: 0x0e1d05f89431 &lt;Socket map = 0x14e5844ebe49&gt; (data field 6)
#httpVersionMajor: 1 (data field 7)
#httpVersionMinor: 1 (data field 8)
#httpVersion: 0x0e1d05f8a531 &lt;String[3]: 1.1&gt; (data field 9)
#complete: 0x15574d2028c9 &lt;true&gt; (data field 10)
#headers: 0x0e1d05f8a4a1 &lt;Object map = 0x14e5844eb241&gt; (data field 11)
#rawHeaders: 0x0e1d05f8a0b1 &lt;JSArray[4]&gt; (data field 12)
#trailers: 0x0e1d05f8a4d9 &lt;Object map = 0x14e584482571&gt; (data field 13)
#rawTrailers: 0x0e1d05f8a511 &lt;JSArray[0]&gt; (data field 14)
#aborted: 0x15574d2029a1 &lt;false&gt; (data field 15)
#upgrade: 0x15574d2029a1 &lt;false&gt; (data field 16)
#url: 0x2ba3efe04d69 &lt;String[1]: /&gt; (data field 17)
#method: 0x08828dac8739 &lt;String[3]: GET&gt; (data field 18)
#statusCode: 0x15574d2022b1 &lt;null&gt; (data field 19)
#statusMessage: 0x15574d2022b1 &lt;null&gt; (data field 20)
#client: 0x0e1d05f89431 &lt;Socket map = 0x14e5844ebe49&gt; (data field 21)
#_consuming: 0x15574d2029a1 &lt;false&gt; (data field 22)
#_dumped: 0x15574d2028c9 &lt;true&gt; (data field 23)
}
0x14e5844ec739: [Map]
- type: JS_OBJECT_TYPE
- instance size: 224
- inobject properties: 25
- elements kind: HOLEY_ELEMENTS
- unused property fields: 1
- enum length: invalid
- back pointer: 0x14e5844ec899 &lt;Map(HOLEY_ELEMENTS)&gt;
- prototype_validity cell: 0x25af6ee37c31 &lt;Cell value= 0&gt;
- instance descriptors #24: 0x0e1d05f870c1 &lt;DescriptorArray[92]&gt;
- layout descriptor: 0
- transitions #1: 0x14e5844ec8f1 &lt;Map(HOLEY_ELEMENTS)&gt;
#req: (transition to (data field, attrs: [WEC]) @ FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope
1: 0x1a151c7 node::DumpBacktrace(_IO_FILE*) [out/Debug/node]
2: 0x1a523d5 node::Abort() [out/Debug/node]
3: 0x1a53076 node::FatalError(char const*, char const*) [out/Debug/node]
4: 0x1df5802 v8::Utils::ReportApiFailure(char const*, char const*) [out/Debug/node]
5: 0x1de2785 v8::Utils::ApiCheck(bool, char const*, char const*) [out/Debug/node]
6: 0x24da526 v8::internal::HandleScope::Extend(v8::internal::Isolate*) [out/Debug/node]
7: 0x1dcc33e v8::internal::HandleScope::CreateHandle(v8::internal::Isolate*, v8::internal::Object*) [out/Debug/node]
8: 0x1dcc412 v8::internal::HandleScope::GetHandle(v8::internal::Isolate*, v8::internal::Object*) [out/Debug/node]
9: 0x1dcc05b v8::internal::HandleBase::HandleBase(v8::internal::Object*, v8::internal::Isolate*) [out/Debug/node]
10: 0x1dde2f5 v8::internal::Handle&lt;v8::internal::Map&gt;::Handle(v8::internal::Map*, v8::internal::Isolate*) [out/Debug/node]
11: 0x1ef96be v8::internal::Handle&lt;v8::internal::Map&gt; v8::internal::handle&lt;v8::internal::Map&gt;(v8::internal::Map*, v8::internal::Isolate*) [out/Debug/node]
12: 0x24c01f2 v8::internal::FieldType::AsClass() [out/Debug/node]
13: 0x24c0435 v8::internal::FieldType::PrintTo(std::ostream&amp;) [out/Debug/node]
14: 0x27038b8 v8::internal::DescriptorArray::PrintDescriptorDetails(std::ostream&amp;, int, v8::internal::PropertyDetails::PrintMode) [out/Debug/node]
15: 0x2703c5a v8::internal::TransitionsAccessor::PrintOneTransition(std::ostream&amp;, v8::internal::Name*, v8::internal::Map*) [out/Debug/node]
16: 0x2703df8 v8::internal::TransitionsAccessor::PrintTransitions(std::ostream&amp;) [out/Debug/node]
17: 0x26fb22c v8::internal::Map::MapPrint(std::ostream&amp;) [out/Debug/node]
18: 0x26f827c v8::internal::HeapObject::HeapObjectPrint(std::ostream&amp;) [out/Debug/node]
19: 0x26f8073 v8::internal::Object::Print(std::ostream&amp;) [out/Debug/node]
20: 0x29a282f [out/Debug/node]
21: 0x29a24d1 v8::internal::Runtime_DebugPrint(int, v8::internal::Object**, v8::internal::Isolate*) [out/Debug/node]
22: 0x3fcb0b31695f
...
</error>
</testcase>
Expand Down
1 change: 1 addition & 0 deletions test/output/test2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
duration_ms: 1.711
exitcode: 1
severity: fail
stack: ''
...
</failure>
</testcase>
Expand Down
5 changes: 3 additions & 2 deletions test/output/test3.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<testsuites disabled="0" errors="1" failures="0" tests="2367" time="1.138146">
<testsuite disabled="0" errors="1" failures="0" name="test/fixtures/test3" skipped="25" tests="2367" time="1.138146" hostname="{HOSTNAME}">
<testsuites disabled="0" errors="1" failures="0" tests="2367" time="1.1381459999999999">
<testsuite disabled="0" errors="1" failures="0" name="test/fixtures/test3" skipped="25" tests="2367" time="1.1381459999999999" hostname="{HOSTNAME}">
<testcase name="test-async-await" time="0.000601" classname="async-hooks"/>
<testcase name="test-callback-error" time="0.000764" classname="async-hooks"/>
<testcase name="test-crypto-pbkdf2" time="0.000225" classname="async-hooks"/>
Expand Down Expand Up @@ -2191,6 +2191,7 @@
duration_ms: 41.541
exitcode: -9
severity: crashed
stack: ''
...
</error>
</testcase>
Expand Down
Loading

0 comments on commit 4ddd247

Please sign in to comment.