diff --git a/__tests__/fixtures/dart-json.json b/__tests__/fixtures/dart-json.json index 91b09db..79c3895 100644 --- a/__tests__/fixtures/dart-json.json +++ b/__tests__/fixtures/dart-json.json @@ -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} diff --git a/reports/dart/test/main_test.dart b/reports/dart/test/main_test.dart index 91f944b..6b74e98 100644 --- a/reports/dart/test/main_test.dart +++ b/reports/dart/test/main_test.dart @@ -24,4 +24,6 @@ void main() { throw Exception('Some error'); }); }); + + print('Hello from the test'); } diff --git a/src/parsers/dart-json/dart-json-parser.ts b/src/parsers/dart-json/dart-json-parser.ts index 891cba6..f42ccf5 100644 --- a/src/parsers/dart-json/dart-json-parser.ts +++ b/src/parsers/dart-json/dart-json-parser.ts @@ -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