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

🐛 Bug: --fail-zero always fails the test run when --delay is also used #4950

Open
4 tasks done
tonimellodic opened this issue Nov 24, 2022 · 0 comments · May be fixed by #5057
Open
4 tasks done

🐛 Bug: --fail-zero always fails the test run when --delay is also used #4950

tonimellodic opened this issue Nov 24, 2022 · 0 comments · May be fixed by #5057
Labels
status: accepting prs Mocha can use your help with this one! type: bug a defect, confirmed by a maintainer

Comments

@tonimellodic
Copy link

Prerequisites

  • Checked that your issue hasn't already been filed by cross-referencing issues with the faq label
  • Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
  • 'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
  • Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend that you not install Mocha globally.

Description

Running mocha with --fail-zero and --delay options, and calling run(). The exit code is always 1, even when some tests did run.

Steps to Reproduce

I created a gist with the files used in the examples below: https://gist.github.com/tonimellodic/525d29054744ca6d602145b81eb57e80

Expected behavior: Running with --fail-zero and --delay produces exit 0 when at least one test run.

Actual behavior: Running with --fail-zero and --delay always produces exit 1.

Running with --fail-zero only:

% npx mocha --fail-zero test/no-delay.js     

  No delay example
    ✔ runs a test

  1 passing (3ms)

% echo $?
0

Running with --fail-zero and --delay:

% npx mocha --fail-zero --delay test/delay.js

  Delay example
    ✔ runs a delayed test

  1 passing (5ms)

% echo $?
1

Reproduces how often: Always

Versions

mocha 10.1.0
node 16.13.1
MacOS 12.6.1
zsh shell

@juergba juergba added type: bug a defect, confirmed by a maintainer and removed unconfirmed-bug labels Dec 25, 2022
@juergba juergba self-assigned this Dec 25, 2022
@JoshuaKGoldberg JoshuaKGoldberg added the status: accepting prs Mocha can use your help with this one! label Dec 27, 2023
@JoshuaKGoldberg JoshuaKGoldberg changed the title --fail-zero always fails the test run when --delay is also used 🐛 Bug: --fail-zero always fails the test run when --delay is also used Dec 27, 2023
@joandino joandino linked a pull request Dec 28, 2023 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Mocha can use your help with this one! type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants