mirror of
https://github.com/dorny/test-reporter.git
synced 2026-02-01 02:45:22 -08:00
Fix dart-json parsing broken by print message
Print message related to suite, instead of a specific test, would break parsing - it would expect test object to be present in dictionary but there would be none. This fix adds necessary check and messages not related to tracked tests will be ignored.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
{"suite":{"id":2,"platform":"vm","path":"test\\second_test.dart"},"type":"suite","time":11}
|
||||
{"test":{"id":3,"name":"loading test\\second_test.dart","suiteID":2,"groupIDs":[],"metadata":{"skip":false,"skipReason":null},"line":null,"column":null,"url":null},"type":"testStart","time":11}
|
||||
{"count":2,"type":"allSuites","time":11}
|
||||
{"testID":1,"messageType":"print","message":"Hello from the test","type":"print","time":3828}
|
||||
{"testID":3,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":3649}
|
||||
{"group":{"id":4,"suiteID":2,"parentID":null,"name":null,"metadata":{"skip":false,"skipReason":null},"testCount":2,"line":null,"column":null,"url":null},"type":"group","time":3654}
|
||||
{"test":{"id":5,"name":"Timeout test","suiteID":2,"groupIDs":[4],"metadata":{"skip":false,"skipReason":null},"line":5,"column":3,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/second_test.dart"},"type":"testStart","time":3655}
|
||||
|
||||
@@ -24,4 +24,6 @@ void main() {
|
||||
throw Exception('Some error');
|
||||
});
|
||||
});
|
||||
|
||||
print('Hello from the test');
|
||||
}
|
||||
|
||||
@@ -114,11 +114,11 @@ export class DartJsonParser implements TestParser {
|
||||
const group = suite.groups[evt.test.groupIDs[evt.test.groupIDs.length - 1]]
|
||||
group.tests.push(test)
|
||||
tests[evt.test.id] = test
|
||||
} else if (isTestDoneEvent(evt) && !evt.hidden) {
|
||||
} else if (isTestDoneEvent(evt) && !evt.hidden && tests[evt.testID]) {
|
||||
tests[evt.testID].testDone = evt
|
||||
} else if (isErrorEvent(evt)) {
|
||||
} else if (isErrorEvent(evt) && tests[evt.testID]) {
|
||||
tests[evt.testID].error = evt
|
||||
} else if (isMessageEvent(evt)) {
|
||||
} else if (isMessageEvent(evt) && tests[evt.testID]) {
|
||||
tests[evt.testID].print.push(evt)
|
||||
} else if (isDoneEvent(evt)) {
|
||||
success = evt.success
|
||||
|
||||
Reference in New Issue
Block a user