Skip to content

Commit

Permalink
Correct behavior for test cases with slashes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shamus Taylor authored and Jozef Izso committed May 17, 2025
1 parent 34f1c56 commit a0398fb
Show file tree
Hide file tree
Showing 7 changed files with 228 additions and 78 deletions.
19 changes: 12 additions & 7 deletions __tests__/__outputs__/golang-json.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
![Tests failed](https://img.shields.io/badge/tests-3%20passed%2C%205%20failed%2C%201%20skipped-critical)
![Tests failed](https://img.shields.io/badge/tests-5%20passed%2C%206%20failed%2C%201%20skipped-critical)
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|fixtures/golang-json.json|3|5|1 ⚪|4s|
|fixtures/golang-json.json|5|6|1 ⚪|6s|
## ❌ <a id="user-content-r0" href="#user-content-r0">fixtures/golang-json.json</a>
**9** tests were completed in **4s** with **3** passed, **5** failed and **1** skipped.
**12** tests were completed in **6s** with **5** passed, **6** failed and **1** skipped.
|Test suite|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|[_/home/james_t/git/test-reporter/reports/go](#user-content-r0s0)|3|5|1 ⚪|4s|
|[_/home/james_t/git/test-reporter/reports/go](#user-content-r0s0)|5|6|1 ⚪|6s|
### ❌ <a id="user-content-r0s0" href="#user-content-r0s0">_/home/james_t/git/test-reporter/reports/go</a>
```
✅ TestPassing
❌ TestFailing
calculator_test.go:19: expected 1+1 = 3, got 2
❌ TestPanicInsideFunction
calculator_test.go:71: caught panic: runtime error: integer divide by zero
calculator_test.go:76: caught panic: runtime error: integer divide by zero
❌ TestPanicInsideTest
calculator_test.go:71: caught panic: bad stuff
calculator_test.go:76: caught panic: bad stuff
⚪ TestSkipped
calculator_test.go:45: skipping test
Expand All @@ -28,6 +28,11 @@ TestCases
✅ 1_+_2_=_3
✅ 4_+_7_=_11
❌ 2_+_3_=_4
calculator_test.go:62: expected 2 + 3 = 4, got 5
calculator_test.go:67: expected 2 + 3 = 4, got 5
❌ 1_/_2_=_1
calculator_test.go:67: expected 1 / 2 = 1, got 0
✅ 9_/_3_=_3
✅ 14_/_7_=_2
```
49 changes: 36 additions & 13 deletions __tests__/__snapshots__/golang-json.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TestRunResult {
"error": undefined,
"name": "TestPassing",
"result": "success",
"time": 90,
"time": 60,
},
TestCaseResult {
"error": {
Expand All @@ -24,13 +24,13 @@ TestRunResult {
},
"name": "TestFailing",
"result": "failed",
"time": 760,
"time": 890,
},
TestCaseResult {
"error": {
"details": "calculator_test.go:71: caught panic: runtime error: integer divide by zero
"details": "calculator_test.go:76: caught panic: runtime error: integer divide by zero
",
"message": "calculator_test.go:71: caught panic: runtime error: integer divide by zero
"message": "calculator_test.go:76: caught panic: runtime error: integer divide by zero
",
},
"name": "TestPanicInsideFunction",
Expand All @@ -39,9 +39,9 @@ TestRunResult {
},
TestCaseResult {
"error": {
"details": "calculator_test.go:71: caught panic: bad stuff
"details": "calculator_test.go:76: caught panic: bad stuff
",
"message": "calculator_test.go:71: caught panic: bad stuff
"message": "calculator_test.go:76: caught panic: bad stuff
",
},
"name": "TestPanicInsideTest",
Expand All @@ -57,7 +57,7 @@ TestRunResult {
},
"name": "TestSkipped",
"result": "skipped",
"time": 110,
"time": 940,
},
TestCaseResult {
"error": {
Expand All @@ -66,7 +66,7 @@ TestRunResult {
},
"name": "TestCases",
"result": "failed",
"time": 1620,
"time": 2250,
},
],
},
Expand All @@ -77,24 +77,47 @@ TestRunResult {
"error": undefined,
"name": "1_+_2_=_3",
"result": "success",
"time": 540,
"time": 400,
},
TestCaseResult {
"error": undefined,
"name": "4_+_7_=_11",
"result": "success",
"time": 540,
"time": 460,
},
TestCaseResult {
"error": {
"details": "calculator_test.go:62: expected 2 + 3 = 4, got 5
"details": "calculator_test.go:67: expected 2 + 3 = 4, got 5
",
"message": "calculator_test.go:62: expected 2 + 3 = 4, got 5
"message": "calculator_test.go:67: expected 2 + 3 = 4, got 5
",
},
"name": "2_+_3_=_4",
"result": "failed",
"time": 530,
"time": 90,
},
TestCaseResult {
"error": {
"details": "calculator_test.go:67: expected 1 / 2 = 1, got 0
",
"message": "calculator_test.go:67: expected 1 / 2 = 1, got 0
",
},
"name": "1_/_2_=_1",
"result": "failed",
"time": 920,
},
TestCaseResult {
"error": undefined,
"name": "9_/_3_=_3",
"result": "success",
"time": 340,
},
TestCaseResult {
"error": undefined,
"name": "14_/_7_=_2",
"result": "success",
"time": 40,
},
],
},
Expand Down
Loading

0 comments on commit a0398fb

Please sign in to comment.