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

Tests and suites do not timeout when a zero timeout is changed to nonzero #4254

Closed
2 of 4 tasks
fasttime opened this issue Apr 27, 2020 · 1 comment · Fixed by #4260
Closed
2 of 4 tasks

Tests and suites do not timeout when a zero timeout is changed to nonzero #4254

fasttime opened this issue Apr 27, 2020 · 1 comment · Fixed by #4260
Labels
type: bug a defect, confirmed by a maintainer

Comments

@fasttime
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 node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend that you not install Mocha globally.

Description

When the timeout of a test or suite is set to zero and then changed again to a positive value, the test or suite does not timeout as expected.

Steps to Reproduce

it.only
(
    'test',
    function (done)
    {
        this.timeout(0);
        this.timeout(10);
        setTimeout(done, 100);
    }
);

Expected behavior: [What you expect to happen]

The test above should timeout and fail.

Actual behavior: [What actually happens]

The test passes.

Reproduces how often: every time

Versions

  • The output of mocha --version and node node_modules/.bin/mocha --version: 7.1.2
  • The output of node --version: 14.0.0

Additional Information

_enableTimeouts is set to false on the Runnable instance when the timeout changes to 0 but never set back to true again.

@craigtaub
Copy link
Contributor

This seems legit. Ive given this a go here #4260

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants