Skip to content

Commit 3035ebd

Browse files
suite as array (#21)
* suite as array
1 parent 40495ce commit 3035ebd

File tree

8 files changed

+212
-24
lines changed

8 files changed

+212
-24
lines changed

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
**Junit CTRF Test Reporter v0.0.12**
1+
**Junit CTRF Test Reporter v0.0.14**
22

33
***
44

5-
# Junit CTRF Test Reporter v0.0.12
5+
# Junit CTRF Test Reporter v0.0.14
66

77
## Interfaces
88

docs/functions/convertJUnitToCTRFReport.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[**Junit CTRF Test Reporter v0.0.12**](../README.md)
1+
[**Junit CTRF Test Reporter v0.0.14**](../README.md)
22

33
***
44

docs/interfaces/ConvertOptions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[**Junit CTRF Test Reporter v0.0.12**](../README.md)
1+
[**Junit CTRF Test Reporter v0.0.14**](../README.md)
22

33
***
44

package-lock.json

Lines changed: 154 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "junit-to-ctrf",
3-
"version": "0.0.13",
3+
"version": "0.0.14",
44
"description": "Convert JUnit XML reports to CTRF JSON",
55
"type": "module",
66
"main": "dist/index.js",
@@ -16,6 +16,7 @@
1616
"format": "prettier --write .",
1717
"format:check": "prettier --check .",
1818
"e2e:junit": "node dist/cli.js reports/test-junit.xml --output reports/test-junit-ctrf.json",
19+
"e2e:junit-nested": "node dist/cli.js reports/test-junit-nested.xml --output reports/test-junit-nested-ctrf.json",
1920
"e2e:minitest": "node dist/cli.js reports/test-minitest-junit.xml --output reports/test-minitest-junit-ctrf.json",
2021
"e2e:surefire": "node dist/cli.js reports/test-surefire.xml --output reports/test-surefire-ctrf.json",
2122
"e2e:glob": "node dist/cli.js \"reports/*.xml\" --output reports/test-glob-ctrf.json",
@@ -48,7 +49,7 @@
4849
"homepage": "https://ctrf.io",
4950
"license": "MIT",
5051
"dependencies": {
51-
"ctrf": "^0.0.13",
52+
"ctrf": "^0.0.17",
5253
"fs-extra": "^11.3.0",
5354
"glob": "^11.0.3",
5455
"typescript": "^5.8.3",

reports/test-junit-nested.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<testsuites>
3+
<testsuite name="com.example.AllTests" tests="10" failures="1" errors="1" skipped="1" time="1.550">
4+
<testsuite name="com.example.UnitTests" tests="6" failures="1" errors="1" skipped="1" time="0.350">
5+
<testcase name="testAddition" classname="com.example.UnitTests" time="0.015"/>
6+
<testcase name="testSubtraction" classname="com.example.UnitTests" time="0.010"/>
7+
<testcase name="testMultiplication" classname="com.example.UnitTests" time="0.020">
8+
<failure message="Expected 10 but was 9" type="AssertionError">
9+
Stack trace details...
10+
</failure>
11+
</testcase>
12+
<testcase name="testDivision" classname="com.example.UnitTests" time="0.000">
13+
<skipped/>
14+
</testcase>
15+
<testcase name="testModulo" classname="com.example.UnitTests" time="0.005">
16+
<error message="NullPointerException occurred" type="java.lang.NullPointerException">
17+
Stack trace details...
18+
</error>
19+
</testcase>
20+
<testcase name="testSquareRoot" classname="com.example.UnitTests" time="0.300"/>
21+
<system-out><![CDATA[Standard output logs for UnitTests]]></system-out>
22+
<system-err><![CDATA[Standard error logs for UnitTests]]></system-err>
23+
</testsuite>
24+
<testsuite name="com.example.IntegrationTests" tests="4" failures="0" errors="0" skipped="0" time="1.200">
25+
<testcase name="testUserLogin" classname="com.example.IntegrationTests" time="0.400"/>
26+
<testcase name="testUserRegistration" classname="com.example.IntegrationTests" time="0.300"/>
27+
<testcase name="testProductSearch" classname="com.example.IntegrationTests" time="0.200"/>
28+
<testcase name="testCheckoutProcess" classname="com.example.IntegrationTests" time="0.300"/>
29+
<system-out><![CDATA[Integration test logs...]]></system-out>
30+
<system-err><![CDATA[Integration test error logs...]]></system-err>
31+
</testsuite>
32+
<system-out><![CDATA[Standard output logs for AllTests suite]]></system-out>
33+
<system-err><![CDATA[Standard error logs for AllTests suite]]></system-err>
34+
</testsuite>
35+
</testsuites>
36+

src/convert.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ describe('createCTRFReport', () => {
8585
duration: 500,
8686
filePath: 'test1.js',
8787
line: 10,
88-
suite: 'TestSuite1',
88+
suite: ['TestSuite1'],
8989
}),
9090
expect.objectContaining({
9191
name: 'testFailed',
@@ -95,15 +95,15 @@ describe('createCTRFReport', () => {
9595
line: 15,
9696
message: 'Test failed',
9797
trace: 'Error: Test failed\n at testFailed (test1.js:15:5)',
98-
suite: 'TestSuite1',
98+
suite: ['TestSuite1'],
9999
}),
100100
expect.objectContaining({
101101
name: 'testSkipped',
102102
status: 'skipped',
103103
duration: 100,
104104
filePath: 'test2.js',
105105
line: 20,
106-
suite: 'TestSuite2',
106+
suite: ['TestSuite2'],
107107
}),
108108
]),
109109
},
@@ -207,7 +207,7 @@ describe('createCTRFReport', () => {
207207
line: undefined,
208208
message: undefined,
209209
trace: undefined,
210-
suite: 'TestSuite',
210+
suite: ['TestSuite'],
211211
}),
212212
])
213213
})
@@ -246,7 +246,7 @@ describe('createCTRFReport', () => {
246246
message: 'Cannot read property of undefined',
247247
trace:
248248
'TypeError: Cannot read property of undefined\n at testWithError (test.js:25:10)',
249-
suite: 'TestSuite',
249+
suite: ['TestSuite'],
250250
}),
251251
])
252252
})

0 commit comments

Comments
 (0)