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

mocha 8.0.0 --watch throws "Mocha instance is already disposed" on code change #4327

Closed
3 of 4 tasks
jeremychone opened this issue Jun 10, 2020 · 5 comments
Closed
3 of 4 tasks
Assignees
Labels
type: bug a defect, confirmed by a maintainer

Comments

@jeremychone
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

Mocha 8.0.0 does not seems to breaks when using --watch with message Mocha instance is already disposed

Steps to Reproduce

With Mocha 0.7.2 running the command below run the tests once and then on code change, execute again (as epected)

./node_modules/.bin/mocha -p ./test/tsconfig.json ./test/spec/*.spec.ts --watch --watch-files './test/**/*.ts','./src/**/*.ts'

With Mocha 8.0.0, run exact same command, on exact same code, will run the tests once correctly, but doing a code change will throw the following error in the terminal.

(node:8867) UnhandledPromiseRejectionWarning: Error: Mocha instance is already disposed, cannot start a new test run. Please create a new mocha instance. Be sure to set disable `cleanReferencesAfterRun` when you want to reuse the same mocha instance for multiple test runs.
....

Versions

  • mac os latest catalina, zsh, TypeScript 39.5

Addtional information

.mocharc.yaml

require: ts-node/register
@boneskull boneskull added type: bug a defect, confirmed by a maintainer and removed unconfirmed-bug labels Jun 10, 2020
@boneskull
Copy link
Member

I'll look at this

@boneskull
Copy link
Member

I have a fix and will release soon

@boneskull
Copy link
Member

Ref: #4328

@boneskull
Copy link
Member

Fixed in v8.0.1

@jeremychone
Copy link
Author

That was fast. Confirmed, fixed. Thanks.

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

No branches or pull requests

3 participants