Skip to content

Commit

Permalink
fix: flake and retry
Browse files Browse the repository at this point in the history
  • Loading branch information
Ma11hewThomas committed Apr 22, 2024
1 parent 3b15bfa commit 3692841
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A Jest test reporter to create test reports that follow the CTRF standard.

[Common Test Report Format](https://ctrf.io) ensures the generation of uniform JSON test reports, independent of programming languages or test framework in use.

**If you find this project useful, consider giving it a GitHub star**
**If you find this project useful, or think it is interesting, we would love a star ❤️**

It means a lot to us and helps us grow this open source library.

Expand Down Expand Up @@ -119,8 +119,8 @@ The test object in the report includes the following [CTRF properties](https://c
| `rawStatus` | String | Optional | The original jest status of the test before mapping to CTRF status. |
| `type` | String | Optional | The type of test (e.g., `unit`, `component`). |
| `filepath` | String | Optional | The file path where the test is located in the project. |
| `retry` | Number | Optional | The number of retries attempted for the test. |
| `flake` | Boolean | Optional | Indicates whether the test result is flaky. |
| `retries` | Number | Optional | The number of retries attempted for the test. |
| `flaky` | Boolean | Optional | Indicates whether the test result is flaky. |

## Support Us

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-ctrf-json-reporter",
"version": "0.0.4",
"version": "0.0.6",
"description": "A Jest test reporter to create test results reports",
"main": "dist/index.js",
"scripts": {
Expand Down
5 changes: 3 additions & 2 deletions src/generate-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class GenerateCtrfReport implements Reporter {
outputFile: reporterOptions?.outputFile ?? this.defaultOutputFile,
outputDir: reporterOptions?.outputDir ?? this.defaultOutputDir,
minimal: reporterOptions?.minimal ?? false,
testType: reporterOptions.testType ?? 'unit',
appName: reporterOptions?.appName ?? undefined,
appVersion: reporterOptions?.appVersion ?? undefined,
osPlatform: reporterOptions?.osPlatform ?? undefined,
Expand Down Expand Up @@ -135,8 +136,8 @@ class GenerateCtrfReport implements Reporter {
test.rawStatus = testCaseResult.status
test.type = this.reporterConfigOptions.testType ?? 'unit'
test.filePath = testResult.testFilePath
test.retry = (testCaseResult.invocations ?? 1) - 1
test.flake =
test.retries = (testCaseResult.invocations ?? 1) - 1
test.flaky =
testCaseResult.status === 'passed' &&
(testCaseResult.invocations ?? 1) - 1 > 0
test.suite = this.buildSuitePath(testResult, testCaseResult)
Expand Down
4 changes: 2 additions & 2 deletions types/ctrf.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export interface CtrfTest {
tags?: string[]
type?: string
filePath?: string
retry?: number
flake?: boolean
retries?: number
flaky?: boolean
attempts?: CtrfTest[]
browser?: string
device?: string
Expand Down

0 comments on commit 3692841

Please sign in to comment.