-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from dorny/dart-json
Support dart-json
- Loading branch information
Showing
16 changed files
with
1,112 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`dart-json tests matches report snapshot 1`] = ` | ||
Object { | ||
"annotations": Array [ | ||
Object { | ||
"annotation_level": "failure", | ||
"end_line": 13, | ||
"message": "Expected: <2> | ||
Actual: <1> | ||
package:test_api expect | ||
test\\\\main_test.dart 13:9 main.<fn>.<fn>.<fn> | ||
", | ||
"path": "test/main_test.dart", | ||
"start_line": 13, | ||
"title": "[test\\\\main_test.dart] Test 1 Test 1.1 Failing test", | ||
}, | ||
Object { | ||
"annotation_level": "failure", | ||
"end_line": 2, | ||
"message": "Exception: Some error | ||
package:darttest/main.dart 2:3 throwError | ||
test\\\\main_test.dart 17:9 main.<fn>.<fn>.<fn> | ||
", | ||
"path": "lib/main.dart", | ||
"start_line": 2, | ||
"title": "[test\\\\main_test.dart] Test 1 Test 1.1 Exception in target unit", | ||
}, | ||
Object { | ||
"annotation_level": "failure", | ||
"end_line": 24, | ||
"message": "Exception: Some error | ||
test\\\\main_test.dart 24:7 main.<fn>.<fn> | ||
", | ||
"path": "test/main_test.dart", | ||
"start_line": 24, | ||
"title": "[test\\\\main_test.dart] Test 2 Exception in test", | ||
}, | ||
Object { | ||
"annotation_level": "failure", | ||
"end_line": 5, | ||
"message": "TimeoutException after 0:00:00.000001: Test timed out after 0 seconds. | ||
dart:isolate _RawReceivePortImpl._handleMessage | ||
", | ||
"path": "test/second_test.dart", | ||
"start_line": 5, | ||
"title": "[test\\\\second_test.dart] Timeout test", | ||
}, | ||
], | ||
"summary": "**6** tests were completed in **3.760s** with **1** passed, **1** skipped and **4** failed. | ||
| Result | Suite | Tests | Time | Passed ✔️ | Failed ❌ | Skipped ✖️ | | ||
| :---: | :--- | ---: | ---: | ---: | ---: | ---: | | ||
| ❌ | [test\\\\main_test.dart](#ts-0-test-maintest-dart) | 4 | 74ms | 1 | 3 | 0 | | ||
| ❌ | [test\\\\second_test.dart](#ts-1-test-secondtest-dart) | 2 | 51ms | 0 | 1 | 1 | | ||
# Test Suites | ||
## <a id=\\"user-content-ts-0-test-maintest-dart\\" href=\\"#ts-0-test-maintest-dart\\">test\\\\main_test.dart</a> ❌ | ||
### Test 1 | ||
| Result | Test | Time | | ||
| :---: | :--- | ---: | | ||
| ✔️ | Test 1 Passing test | 36ms | | ||
### Test 1 Test 1.1 | ||
| Result | Test | Time | | ||
| :---: | :--- | ---: | | ||
| ❌ | Test 1 Test 1.1 Failing test | 20ms | | ||
| ❌ | Test 1 Test 1.1 Exception in target unit | 6ms | | ||
### Test 2 | ||
| Result | Test | Time | | ||
| :---: | :--- | ---: | | ||
| ❌ | Test 2 Exception in test | 12ms | | ||
## <a id=\\"user-content-ts-1-test-secondtest-dart\\" href=\\"#ts-1-test-secondtest-dart\\">test\\\\second_test.dart</a> ❌ | ||
| Result | Test | Time | | ||
| :---: | :--- | ---: | | ||
| ❌ | Timeout test | 37ms | | ||
| ✖️ | Skipped test | 14ms | | ||
", | ||
"title": "Dart tests ❌", | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as fs from 'fs' | ||
import * as path from 'path' | ||
|
||
import {parseDartJson} from '../src/parsers/dart-json/dart-json-parser' | ||
import {ParseOptions} from '../src/parsers/parser-types' | ||
|
||
const xmlFixture = fs.readFileSync(path.join(__dirname, 'fixtures', 'dart-json.json'), {encoding: 'utf8'}) | ||
const outputPath = __dirname + '/__outputs__/dart-json.md' | ||
|
||
describe('dart-json tests', () => { | ||
it('matches report snapshot', async () => { | ||
const opts: ParseOptions = { | ||
name: 'Dart tests', | ||
annotations: true, | ||
trackedFiles: ['lib/main.dart', 'test/main_test.dart', 'test/second_test.dart'], | ||
workDir: 'C:/Users/Michal/Workspace/dorny/test-check/reports/dart/' | ||
} | ||
|
||
const result = await parseDartJson(xmlFixture, opts) | ||
fs.mkdirSync(path.dirname(outputPath), {recursive: true}) | ||
fs.writeFileSync(outputPath, result?.output?.summary ?? '') | ||
|
||
expect(result.success).toBeFalsy() | ||
expect(result?.output).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,31 @@ | ||
{"protocolVersion":"0.1.1","runnerVersion":"1.15.4","pid":21728,"type":"start","time":0} | ||
{"suite":{"id":0,"platform":"vm","path":"test\\main_test.dart"},"type":"suite","time":1} | ||
{"protocolVersion":"0.1.1","runnerVersion":"1.15.4","pid":7504,"type":"start","time":0} | ||
{"suite":{"id":0,"platform":"vm","path":"test\\main_test.dart"},"type":"suite","time":0} | ||
{"test":{"id":1,"name":"loading test\\main_test.dart","suiteID":0,"groupIDs":[],"metadata":{"skip":false,"skipReason":null},"line":null,"column":null,"url":null},"type":"testStart","time":1} | ||
{"suite":{"id":2,"platform":"vm","path":"test\\second_test.dart"},"type":"suite","time":12} | ||
{"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":12} | ||
{"count":2,"type":"allSuites","time":13} | ||
{"testID":3,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":3761} | ||
{"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":3766} | ||
{"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":3767} | ||
{"testID":1,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":3784} | ||
{"group":{"id":6,"suiteID":0,"parentID":null,"name":null,"metadata":{"skip":false,"skipReason":null},"testCount":5,"line":null,"column":null,"url":null},"type":"group","time":3784} | ||
{"group":{"id":7,"suiteID":0,"parentID":6,"name":"Test 1","metadata":{"skip":false,"skipReason":null},"testCount":3,"line":6,"column":3,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"group","time":3785} | ||
{"test":{"id":8,"name":"Test 1 Passing test","suiteID":0,"groupIDs":[6,7],"metadata":{"skip":false,"skipReason":null},"line":7,"column":5,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"testStart","time":3785} | ||
{"testID":5,"error":"TimeoutException after 0:00:00.000001: Test timed out after 0 seconds.","stackTrace":"dart:isolate _RawReceivePortImpl._handleMessage\n","isFailure":false,"type":"error","time":3804} | ||
{"testID":5,"result":"error","skipped":false,"hidden":false,"type":"testDone","time":3804} | ||
{"test":{"id":9,"name":"Skipped test","suiteID":2,"groupIDs":[4],"metadata":{"skip":true,"skipReason":"skipped test"},"line":9,"column":3,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/second_test.dart"},"type":"testStart","time":3805} | ||
{"testID":9,"messageType":"skip","message":"Skip: skipped test","type":"print","time":3807} | ||
{"testID":9,"result":"success","skipped":true,"hidden":false,"type":"testDone","time":3808} | ||
{"testID":8,"result":"success","skipped":false,"hidden":false,"type":"testDone","time":3815} | ||
{"group":{"id":10,"suiteID":0,"parentID":7,"name":"Test 1 Test 1.1","metadata":{"skip":false,"skipReason":null},"testCount":2,"line":11,"column":5,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"group","time":3817} | ||
{"test":{"id":11,"name":"Test 1 Test 1.1 Failing test","suiteID":0,"groupIDs":[6,7,10],"metadata":{"skip":false,"skipReason":null},"line":12,"column":7,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"testStart","time":3817} | ||
{"testID":11,"error":"Expected: <2>\n Actual: <1>\n","stackTrace":"package:test_api expect\ntest\\main_test.dart 13:9 main.<fn>.<fn>.<fn>\n","isFailure":true,"type":"error","time":3840} | ||
{"testID":11,"result":"failure","skipped":false,"hidden":false,"type":"testDone","time":3840} | ||
{"test":{"id":12,"name":"Test 1 Test 1.1 Exception in target unit","suiteID":0,"groupIDs":[6,7,10],"metadata":{"skip":false,"skipReason":null},"line":16,"column":7,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"testStart","time":3845} | ||
{"testID":12,"error":"Exception: Some error","stackTrace":"package:darttest/main.dart 2:3 throwError\ntest\\main_test.dart 17:9 main.<fn>.<fn>.<fn>\n","isFailure":false,"type":"error","time":3852} | ||
{"testID":12,"result":"error","skipped":false,"hidden":false,"type":"testDone","time":3853} | ||
{"group":{"id":13,"suiteID":0,"parentID":6,"name":"Test 2","metadata":{"skip":false,"skipReason":null},"testCount":2,"line":22,"column":3,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"group","time":3854} | ||
{"test":{"id":14,"name":"Test 2 Exception in test","suiteID":0,"groupIDs":[6,13],"metadata":{"skip":false,"skipReason":null},"line":23,"column":5,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"testStart","time":3854} | ||
{"testID":14,"error":"Exception: Some error","stackTrace":"test\\main_test.dart 24:7 main.<fn>.<fn>\n","isFailure":false,"type":"error","time":3869} | ||
{"testID":14,"result":"error","skipped":false,"hidden":false,"type":"testDone","time":3869} | ||
{"test":{"id":15,"name":"Test 2 Timeout test","suiteID":0,"groupIDs":[6,13],"metadata":{"skip":false,"skipReason":null},"line":27,"column":5,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"testStart","time":3870} | ||
{"testID":15,"result":"success","skipped":false,"hidden":false,"type":"testDone","time":3882} | ||
{"success":false,"type":"done","time":3886} | ||
{"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":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} | ||
{"testID":1,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":3672} | ||
{"group":{"id":6,"suiteID":0,"parentID":null,"name":null,"metadata":{"skip":false,"skipReason":null},"testCount":4,"line":null,"column":null,"url":null},"type":"group","time":3672} | ||
{"group":{"id":7,"suiteID":0,"parentID":6,"name":"Test 1","metadata":{"skip":false,"skipReason":null},"testCount":3,"line":6,"column":3,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"group","time":3672} | ||
{"test":{"id":8,"name":"Test 1 Passing test","suiteID":0,"groupIDs":[6,7],"metadata":{"skip":false,"skipReason":null},"line":7,"column":5,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"testStart","time":3672} | ||
{"testID":5,"error":"TimeoutException after 0:00:00.000001: Test timed out after 0 seconds.","stackTrace":"dart:isolate _RawReceivePortImpl._handleMessage\n","isFailure":false,"type":"error","time":3692} | ||
{"testID":5,"result":"error","skipped":false,"hidden":false,"type":"testDone","time":3692} | ||
{"test":{"id":9,"name":"Skipped test","suiteID":2,"groupIDs":[4],"metadata":{"skip":true,"skipReason":"skipped test"},"line":9,"column":3,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/second_test.dart"},"type":"testStart","time":3693} | ||
{"testID":9,"messageType":"skip","message":"Skip: skipped test","type":"print","time":3706} | ||
{"testID":9,"result":"success","skipped":true,"hidden":false,"type":"testDone","time":3707} | ||
{"testID":8,"result":"success","skipped":false,"hidden":false,"type":"testDone","time":3708} | ||
{"group":{"id":10,"suiteID":0,"parentID":7,"name":"Test 1 Test 1.1","metadata":{"skip":false,"skipReason":null},"testCount":2,"line":11,"column":5,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"group","time":3715} | ||
{"test":{"id":11,"name":"Test 1 Test 1.1 Failing test","suiteID":0,"groupIDs":[6,7,10],"metadata":{"skip":false,"skipReason":null},"line":12,"column":7,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"testStart","time":3716} | ||
{"testID":11,"error":"Expected: <2>\n Actual: <1>\n","stackTrace":"package:test_api expect\ntest\\main_test.dart 13:9 main.<fn>.<fn>.<fn>\n","isFailure":true,"type":"error","time":3736} | ||
{"testID":11,"result":"failure","skipped":false,"hidden":false,"type":"testDone","time":3736} | ||
{"test":{"id":12,"name":"Test 1 Test 1.1 Exception in target unit","suiteID":0,"groupIDs":[6,7,10],"metadata":{"skip":false,"skipReason":null},"line":16,"column":7,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"testStart","time":3737} | ||
{"testID":12,"error":"Exception: Some error","stackTrace":"package:darttest/main.dart 2:3 throwError\ntest\\main_test.dart 17:9 main.<fn>.<fn>.<fn>\n","isFailure":false,"type":"error","time":3743} | ||
{"testID":12,"result":"error","skipped":false,"hidden":false,"type":"testDone","time":3743} | ||
{"group":{"id":13,"suiteID":0,"parentID":6,"name":"Test 2","metadata":{"skip":false,"skipReason":null},"testCount":1,"line":22,"column":3,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"group","time":3744} | ||
{"test":{"id":14,"name":"Test 2 Exception in test","suiteID":0,"groupIDs":[6,13],"metadata":{"skip":false,"skipReason":null},"line":23,"column":5,"url":"file:///C:/Users/Michal/Workspace/dorny/test-check/reports/dart/test/main_test.dart"},"type":"testStart","time":3744} | ||
{"testID":14,"error":"Exception: Some error","stackTrace":"test\\main_test.dart 24:7 main.<fn>.<fn>\n","isFailure":false,"type":"error","time":3756} | ||
{"testID":14,"result":"error","skipped":false,"hidden":false,"type":"testDone","time":3756} | ||
{"success":false,"type":"done","time":3760} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.