Skip to content

Add splitTestsCompilation solidity setting (7): Typechain updates#8134

Merged
alcuadrado merged 9 commits intodont-split-compilationsfrom
dont-split-compilations-phase-7
Apr 16, 2026
Merged

Add splitTestsCompilation solidity setting (7): Typechain updates#8134
alcuadrado merged 9 commits intodont-split-compilationsfrom
dont-split-compilations-phase-7

Conversation

@alcuadrado
Copy link
Copy Markdown
Member

@alcuadrado alcuadrado commented Apr 12, 2026

Fairly straightforward update to the TypeChain plugin. The main difference is that now with splitTestsCompilation === false it needs to ignore the test contracts.

No errors are expected after this PR

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 12, 2026

⚠️ No Changeset found

Latest commit: b80aa4a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sol and test/) 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).

Comment thread packages/hardhat-typechain/src/internal/hook-handlers/solidity.ts Outdated
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-6 branch from ea57d09 to 50c9d99 Compare April 13, 2026 09:35
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-7 branch from e8842ef to a39546a Compare April 13, 2026 09:35
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-6 branch from 50c9d99 to d787c3d Compare April 13, 2026 10:32
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-7 branch from a39546a to e61c8a7 Compare April 13, 2026 10:32
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-6 branch from d787c3d to 5a1a3d2 Compare April 13, 2026 11:07
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-7 branch from e61c8a7 to 16d93c5 Compare April 13, 2026 11:07
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-6 branch from 5a1a3d2 to 7fb9a86 Compare April 13, 2026 11:21
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-7 branch from 16d93c5 to 3b8c159 Compare April 13, 2026 11:21
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-6 branch from 7fb9a86 to bf63fb6 Compare April 13, 2026 11:39
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-7 branch from 3b8c159 to 69fd895 Compare April 13, 2026 11:39
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-6 branch from bf63fb6 to 0460272 Compare April 13, 2026 12:05
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-7 branch from 69fd895 to 5cd78b9 Compare April 13, 2026 12:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 13 changed files in this pull request and generated 3 comments.

Comment thread packages/hardhat-typechain/src/internal/hook-handlers/solidity.ts Outdated
Comment thread packages/hardhat-typechain/test/fixture-projects/unified-mode/package.json Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 19 changed files in this pull request and generated 1 comment.

Comment thread packages/hardhat-typechain/src/internal/hook-handlers/solidity.ts
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 19 changed files in this pull request and generated 1 comment.

Comment thread packages/hardhat-typechain/src/internal/hook-handlers/solidity.ts
Copy link
Copy Markdown
Member

@schaable schaable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from dont-split-compilations-phase-6 to dont-split-compilations April 16, 2026 16:36
@alcuadrado alcuadrado merged commit 3b58254 into dont-split-compilations Apr 16, 2026
437 of 439 checks passed
@alcuadrado alcuadrado deleted the dont-split-compilations-phase-7 branch April 16, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants