@@ -21,6 +21,30 @@ describe('Swift Testing line parsers', () => {
2121 } ) ;
2222 } ) ;
2323
24+ it ( 'should parse a passed test with verbose aka suffix' , ( ) => {
25+ const result = parseSwiftTestingResultLine (
26+ "✔ Test \"String operations\" (aka 'stringTest()') passed after 0.001 seconds." ,
27+ ) ;
28+ expect ( result ) . toEqual ( {
29+ status : 'passed' ,
30+ rawName : 'String operations' ,
31+ testName : 'String operations' ,
32+ durationText : '0.001s' ,
33+ } ) ;
34+ } ) ;
35+
36+ it ( 'should parse a passed parameterized test' , ( ) => {
37+ const result = parseSwiftTestingResultLine (
38+ '✔ Test "Parameterized test" with 3 test cases passed after 0.001 seconds.' ,
39+ ) ;
40+ expect ( result ) . toEqual ( {
41+ status : 'passed' ,
42+ rawName : 'Parameterized test' ,
43+ testName : 'Parameterized test' ,
44+ durationText : '0.001s' ,
45+ } ) ;
46+ } ) ;
47+
2448 it ( 'should parse a failed test' , ( ) => {
2549 const result = parseSwiftTestingResultLine (
2650 '✘ Test "Expected failure" failed after 0.001 seconds with 1 issue.' ,
@@ -33,7 +57,40 @@ describe('Swift Testing line parsers', () => {
3357 } ) ;
3458 } ) ;
3559
36- it ( 'should parse a skipped test' , ( ) => {
60+ it ( 'should parse a failed test with verbose aka suffix' , ( ) => {
61+ const result = parseSwiftTestingResultLine (
62+ "✘ Test \"Expected failure\" (aka 'deliberateFailure()') failed after 0.001 seconds with 1 issue." ,
63+ ) ;
64+ expect ( result ) . toEqual ( {
65+ status : 'failed' ,
66+ rawName : 'Expected failure' ,
67+ testName : 'Expected failure' ,
68+ durationText : '0.001s' ,
69+ } ) ;
70+ } ) ;
71+
72+ it ( 'should parse a failed parameterized test' , ( ) => {
73+ const result = parseSwiftTestingResultLine (
74+ '✘ Test "Parameterized failure" with 3 test cases failed after 0.001 seconds with 1 issue.' ,
75+ ) ;
76+ expect ( result ) . toEqual ( {
77+ status : 'failed' ,
78+ rawName : 'Parameterized failure' ,
79+ testName : 'Parameterized failure' ,
80+ durationText : '0.001s' ,
81+ } ) ;
82+ } ) ;
83+
84+ it ( 'should parse a skipped test (arrow format)' , ( ) => {
85+ const result = parseSwiftTestingResultLine ( '➜ Test disabledTest() skipped: "Not ready yet"' ) ;
86+ expect ( result ) . toEqual ( {
87+ status : 'skipped' ,
88+ rawName : 'disabledTest' ,
89+ testName : 'disabledTest' ,
90+ } ) ;
91+ } ) ;
92+
93+ it ( 'should parse a skipped test (legacy diamond format)' , ( ) => {
3794 const result = parseSwiftTestingResultLine ( '◇ Test "Disabled test" skipped.' ) ;
3895 expect ( result ) . toEqual ( {
3996 status : 'skipped' ,
@@ -42,6 +99,15 @@ describe('Swift Testing line parsers', () => {
4299 } ) ;
43100 } ) ;
44101
102+ it ( 'should parse a skipped test without reason' , ( ) => {
103+ const result = parseSwiftTestingResultLine ( '➜ Test disabledTest skipped' ) ;
104+ expect ( result ) . toEqual ( {
105+ status : 'skipped' ,
106+ rawName : 'disabledTest' ,
107+ testName : 'disabledTest' ,
108+ } ) ;
109+ } ) ;
110+
45111 it ( 'should return null for non-matching lines' , ( ) => {
46112 expect ( parseSwiftTestingResultLine ( '◇ Test "Foo" started.' ) ) . toBeNull ( ) ;
47113 expect ( parseSwiftTestingResultLine ( 'random text' ) ) . toBeNull ( ) ;
@@ -61,6 +127,30 @@ describe('Swift Testing line parsers', () => {
61127 } ) ;
62128 } ) ;
63129
130+ it ( 'should parse an issue with verbose aka suffix' , ( ) => {
131+ const result = parseSwiftTestingIssueLine (
132+ "✘ Test \"Expected failure\" (aka 'deliberateFailure()') recorded an issue at AuditTests.swift:5:5: Expectation failed: true == false" ,
133+ ) ;
134+ expect ( result ) . toEqual ( {
135+ rawTestName : 'Expected failure' ,
136+ testName : 'Expected failure' ,
137+ location : 'AuditTests.swift:5' ,
138+ message : 'Expectation failed: true == false' ,
139+ } ) ;
140+ } ) ;
141+
142+ it ( 'should parse a parameterized issue with argument values' , ( ) => {
143+ const result = parseSwiftTestingIssueLine (
144+ '✘ Test "Parameterized failure" recorded an issue with 1 argument value → 0 at ParameterizedTests.swift:10:5: Expectation failed: (value → 0) > 0' ,
145+ ) ;
146+ expect ( result ) . toEqual ( {
147+ rawTestName : 'Parameterized failure' ,
148+ testName : 'Parameterized failure' ,
149+ location : 'ParameterizedTests.swift:10' ,
150+ message : 'Expectation failed: (value → 0) > 0' ,
151+ } ) ;
152+ } ) ;
153+
64154 it ( 'should parse an issue without location' , ( ) => {
65155 const result = parseSwiftTestingIssueLine (
66156 '✘ Test "Some test" recorded an issue: Something went wrong' ,
@@ -72,6 +162,17 @@ describe('Swift Testing line parsers', () => {
72162 } ) ;
73163 } ) ;
74164
165+ it ( 'should parse an issue without location with verbose aka suffix' , ( ) => {
166+ const result = parseSwiftTestingIssueLine (
167+ "✘ Test \"Some test\" (aka 'someFunc()') recorded an issue: Something went wrong" ,
168+ ) ;
169+ expect ( result ) . toEqual ( {
170+ rawTestName : 'Some test' ,
171+ testName : 'Some test' ,
172+ message : 'Something went wrong' ,
173+ } ) ;
174+ } ) ;
175+
75176 it ( 'should return null for non-matching lines' , ( ) => {
76177 expect ( parseSwiftTestingIssueLine ( '✘ Test "Foo" failed after 0.001 seconds' ) ) . toBeNull ( ) ;
77178 } ) ;
@@ -100,6 +201,17 @@ describe('Swift Testing line parsers', () => {
100201 } ) ;
101202 } ) ;
102203
204+ it ( 'should parse a summary with singular suite' , ( ) => {
205+ const result = parseSwiftTestingRunSummary (
206+ '✘ Test run with 5 tests in 1 suite failed after 0.001 seconds with 3 issues.' ,
207+ ) ;
208+ expect ( result ) . toEqual ( {
209+ executed : 5 ,
210+ failed : 3 ,
211+ durationText : '0.001s' ,
212+ } ) ;
213+ } ) ;
214+
103215 it ( 'should return null for non-matching lines' , ( ) => {
104216 expect ( parseSwiftTestingRunSummary ( 'random text' ) ) . toBeNull ( ) ;
105217 } ) ;
@@ -112,6 +224,12 @@ describe('Swift Testing line parsers', () => {
112224 ) ;
113225 } ) ;
114226
227+ it ( 'should parse a continuation with version info' , ( ) => {
228+ expect ( parseSwiftTestingContinuationLine ( '↳ Testing Library Version: 1743' ) ) . toBe (
229+ 'Testing Library Version: 1743' ,
230+ ) ;
231+ } ) ;
232+
115233 it ( 'should return null for non-continuation lines' , ( ) => {
116234 expect ( parseSwiftTestingContinuationLine ( 'regular line' ) ) . toBeNull ( ) ;
117235 } ) ;
0 commit comments