-
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
Run tests twice #2140
Run tests twice #2140
Conversation
🦋 Changeset detectedLatest commit: 80a4437 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This is really interesting! This new API of mocha is something I wasn't expecting tbh. I think the decision we need to make is if we are ok with bumping the mocha dependency. If we do, I think we should:
|
This fix is adding
Hardhat-core has a dependency on So in this PR I propose:
I think moving the dep in |
That's a good find! I think that makes sense |
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 [email protected] 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
1649944
to
80a4437
Compare
I have pulled the If we are happy with the version bumps this PR is ready for review. |
packages/e2e/test/fixture-projects/basic-project/test/simple.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one very minor comment, otherwise LGTM
This is a mocha caching and cleanup issue addressed here: mochajs/mocha#2783.
Relates to #1720
Testing
An integration test has been added to e2e to cover the run twice scenario and guard against regression of the bug.
Manual
To test manually:
./scripts/multi-run.js
:npx hardhat run ./scripts/multi-run.js
As a test against a more in-depth test suite, I did the equivalent of the above on the open-zepplin test suite (updating to the latest hardhat libs first) and was able to run the suite twice programmatically with the script above.
TODO