Skip to content

Commit

Permalink
Correctly set willBeRetried in messages
Browse files Browse the repository at this point in the history
This fixes #849 [1].

[1] #849
  • Loading branch information
badeball committed Mar 19, 2023
1 parent 3e638aa commit b5ce7af
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## Unreleased

- Correctly set `willBeRetried` in messages reports, fixes [#849](https://github.com/badeball/cypress-cucumber-preprocessor/issues/849).

## v15.1.5

- Correctly escape injected values to glob patterns, fixes [#946](https://github.com/badeball/cypress-cucumber-preprocessor/issues/946).
Expand Down
2 changes: 1 addition & 1 deletion features/fixtures/retried.ndjson
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{"testCaseStarted":{"id":"id","testCaseId":"id","attempt":0,"timestamp":{"seconds":0,"nanos":0}}}
{"testStepStarted":{"testStepId":"id","testCaseStartedId":"id","timestamp":{"seconds":0,"nanos":0}}}
{"testStepFinished":{"testStepId":"id","testCaseStartedId":"id","testStepResult":{"status":"FAILED","message":"some error","duration":0},"timestamp":{"seconds":0,"nanos":0}}}
{"testCaseFinished":{"testCaseStartedId":"id","timestamp":{"seconds":0,"nanos":0},"willBeRetried":false}}
{"testCaseFinished":{"testCaseStartedId":"id","timestamp":{"seconds":0,"nanos":0},"willBeRetried":true}}
{"testCaseStarted":{"id":"id","testCaseId":"id","attempt":1,"timestamp":{"seconds":0,"nanos":0}}}
{"testStepStarted":{"testStepId":"id","testCaseStartedId":"id","timestamp":{"seconds":0,"nanos":0}}}
{"testStepFinished":{"testStepId":"id","testCaseStartedId":"id","testStepResult":{"status":"PASSED","duration":0},"timestamp":{"seconds":0,"nanos":0}}}
Expand Down
12 changes: 11 additions & 1 deletion lib/create-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -808,11 +808,21 @@ export default function createTests(
}
}

const currentRetry = assertAndReturn(
(this.currentTest as any)?._currentRetry,
"Expected to find an attribute _currentRetry"
);

const retries = assertAndReturn(
(this.currentTest as any)?._retries,
"Expected to find an attribute _retries"
);

messages.push({
testCaseFinished: {
testCaseStartedId,
timestamp: endTimestamp,
willBeRetried: false,
willBeRetried: currentRetry < retries,
},
});

Expand Down

0 comments on commit b5ce7af

Please sign in to comment.