-
Notifications
You must be signed in to change notification settings - Fork 267
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
feature: support hardhat test --parallel flag #691
Comments
There is at least one thing that doesn't work when running the coverage task and enabling parallel tests in mocha: the |
From the HH PR referenced above:
@fvictorio Does each worker getting its own HRE happen automagically in Mocha or is this something you're setting up in a mocha reporter hook somewhere? |
It happens because we add something like If you do Does that make sense? |
@fvictorio Yes makes sense, thanks. Not sure but suspect that without a provider initialization task hook to override supporting mocha parallel here might be difficult. (If that's too pessimistic lmk). Another strategy might be:
Does this sound reasonable? (Open to anything fwiw) (register code is here) |
Sorry for not responding sooner @cgewecke! I think the best and easiest solution is to detect that parallel mode is being used and throw an error with instructions? A warning could work too, but maybe it's too easy to miss, and things are not going to work as expected more generally. |
@fvictorio No worries! Your idea sgtm, will do. |
With 0.8.6 an error is thrown when |
Looking at this again...I think it might be possible to support the flag using the same strategy used for hardhat-viem, e.g require that the user signal they're running the coverage task using an environment variable. SOLIDITY_COVERAGE=true npx hardhat coverage --parallel This allows us to initialize the provider correctly before the task begins and then we'd need to:
|
@cgewecke if that works, then why not just do |
@fvictorio Sorry, I might be misunderstanding the problem. I thought if And the environment variable would be used so that coverage-specific EDIT Ah apologies, I've gotten confused about what's visible in the parents/children. You're saying that if I set the process env variable internally in the parent, the children will inherit it? |
Update: made a sample project to see when all the hooks run and I understand how this can work now. Please ignore questions in previous comment...will try to work up a PR for this tomorrow. |
HH is supporting mocha parallelism soon. Would like to make sure the data is aggregated correctly (not sure how this works).
We have an existing recipe for knitting together reports from different jobs if that's necessary (see #662).
cf: hh 2359
The text was updated successfully, but these errors were encountered: