Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dart-json parsing broken by print message #114

Merged
merged 2 commits into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions __tests__/fixtures/dart-json.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
14 changes: 7 additions & 7 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions reports/dart/test/main_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ void main() {
throw Exception('Some error');
});
});

print('Hello from the test');
}
6 changes: 3 additions & 3 deletions src/parsers/dart-json/dart-json-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down