Add splitTestsCompilation solidity setting (7): Typechain updates#8134
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR updates the Hardhat TypeChain integration to correctly exclude test artifacts from type generation when solidity.splitTestsCompilation === false (unified compilation mode), while adding regression tests/fixtures to validate unified-mode artifact behavior and npm dependency classification.
Changes:
- Filter TypeChain’s artifact list in unified mode using
hre.solidity.getScope()so only contract-scope sources generate types. - Add TypeChain tests + new fixture projects to ensure test artifacts (including
.t.solandtest/) don’t generate types in unified mode. - Add Hardhat core integration tests validating artifact APIs include test artifacts in unified mode and that ambiguous bare-name lookup fails.
Reviewed changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/hardhat-typechain/src/internal/hook-handlers/solidity.ts | Filters artifact paths in unified mode to exclude test-scope sources before running TypeChain generation. |
| packages/hardhat-typechain/test/index.ts | Adds coverage for “no types for test artifacts in unified mode” and npm dependency behavior; adjusts an existing test to enable splitTestsCompilation for scope: "tests". |
| packages/hardhat-typechain/test/fixture-projects/unified-mode/** | New unified-mode fixture with contracts, .t.sol, and test/ sources to validate filtering. |
| packages/hardhat-typechain/test/fixture-projects/unified-mode-npm/** | New fixture with a fake npm dependency under node_modules for unified-mode npm artifact classification tests. |
| packages/hardhat/test/internal/builtin-plugins/solidity/build-system/integration/artifacts.ts | New Hardhat integration tests for artifact APIs in unified mode (including ambiguity behavior). |
ea57d09 to
50c9d99
Compare
e8842ef to
a39546a
Compare
50c9d99 to
d787c3d
Compare
a39546a to
e61c8a7
Compare
d787c3d to
5a1a3d2
Compare
e61c8a7 to
16d93c5
Compare
5a1a3d2 to
7fb9a86
Compare
16d93c5 to
3b8c159
Compare
7fb9a86 to
bf63fb6
Compare
3b8c159 to
69fd895
Compare
bf63fb6 to
0460272
Compare
69fd895 to
5cd78b9
Compare
5cd78b9 to
3997e74
Compare
Fairly straightforward update to the TypeChain plugin. The main difference is that now with
splitTestsCompilation === falseit needs to ignore the test contracts.No errors are expected after this PR