-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 can't be run programmatically more than once #1720
Labels
type:bug
Something isn't working
Comments
It's mocha loading the test files with |
I found same issue closed on mocha repo #2783. can be helpful. |
kanej
added a commit
that referenced
this issue
Dec 8, 2021
This is a mocha caching and cleanup issue addressed here: mochajs/mocha#2783. Relates to #1720
Merged
3 tasks
kanej
added a commit
that referenced
this issue
Dec 10, 2021
This is a mocha caching and cleanup issue addressed here: mochajs/mocha#2783. Multiple runs of the test task within a hardhat script are now enabled. The resolution is `mocha.dispose` at the end of a run to clear up state. The mocha dispose method was added in mocha@7.2.0 but the @types/mocha doesn't reflect it till `9.0.0`. This commit: * bumps mocha as a dep in hardhat-core to 7.2.0 to be explicit * bumps mocha as a dev-dep everywhere else to 7.2.0 for consistency in our local dev environment * bumps @types/mocha to 9 in dev-deps in all packages to allow use of dispose and consistency across packages - no code changes are required to support this. Note that the sample typescript project already provides a default @types/mocha on version 9.0.0 Relates to #1720
kanej
added a commit
that referenced
this issue
Dec 15, 2021
Fix reruns of `test` in scripts. This is a mocha caching and cleanup issue addressed here: mochajs/mocha#2783. Multiple runs of the test task within a hardhat script are now enabled. The resolution is `mocha.dispose` at the end of a run to clear up state. The mocha dispose method was added in mocha@7.2.0 but the @types/mocha doesn't reflect it till `9.0.0`. This commit: * bumps mocha as a dep in hardhat-core to 7.2.0 to be explicit * bumps mocha as a dev-dep everywhere else to 7.2.0 for consistency in our local dev environment * bumps @types/mocha to 9 in dev-deps in all packages to allow use of dispose and consistency across packages - no code changes are required to support this. Note that the sample typescript project already provides a default @types/mocha on version 9.0.0 Relates to #1720
Merged
Reopening so we can close it when this is released. |
Fixed in |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Reproduction steps:
Create the sample project
Create a script like this:
Run
hh run script.js
Expected result: Tests should be run twice.
Actual result: the second run doesn't find any tests:
This seems like a "mocha caching something" thing.
The text was updated successfully, but these errors were encountered: