Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: programmatic API cannot access retried test objects #4181

Merged
merged 2 commits into from
Feb 24, 2020

Conversation

juergba
Copy link
Contributor

@juergba juergba commented Feb 12, 2020

Description

To re-run a failing test Mocha:

  • clones the test for each attempt
  • passes the test object of the final attempt to the reporter by emitting an EVENT_TEST_END
  • DOES NOT: update the original runner's test array suite.tests with the latest test object

The result of Mocha's core reporters is correct, since they hook into events and use the latest test object. But third party reporters as Mochawesome relying on suite.tests may show incorrect test results.

Description of the Change

We update runner's suite.tests after the final attempt when the EVENT_TEST_END is emitted and replace the first failing test by the test object of the last attempt.

Applicable issues

closes #2188

@juergba juergba added type: feature enhancement proposal semver-patch implementation requires increase of "patch" version number; "bug fixes" labels Feb 12, 2020
@juergba juergba added this to the next milestone Feb 12, 2020
@juergba juergba self-assigned this Feb 12, 2020
@juergba
Copy link
Contributor Author

juergba commented Feb 12, 2020

@adamgruber @dcr007 could you grant this branch a test run, please?

@coveralls
Copy link

coveralls commented Feb 12, 2020

Coverage Status

Coverage increased (+0.02%) to 92.877% when pulling 5395844 on juergba/retries into ac12f2c on master.

@juergba juergba marked this pull request as ready for review February 13, 2020 07:17
@juergba juergba requested a review from a team February 13, 2020 07:18
@juergba juergba merged commit a995e33 into master Feb 24, 2020
@juergba juergba deleted the juergba/retries branch February 24, 2020 17:45
@juergba juergba added the type: bug a defect, confirmed by a maintainer label Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch implementation requires increase of "patch" version number; "bug fixes" type: bug a defect, confirmed by a maintainer type: feature enhancement proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mocha programmatic API doesn't report retries
2 participants