Skip to content

Add splitTestsCompilation solidity setting (6): Solidity test runner updates#8133

Merged
alcuadrado merged 15 commits intodont-split-compilationsfrom
dont-split-compilations-phase-6
Apr 16, 2026
Merged

Add splitTestsCompilation solidity setting (6): Solidity test runner updates#8133
alcuadrado merged 15 commits intodont-split-compilationsfrom
dont-split-compilations-phase-6

Conversation

@alcuadrado
Copy link
Copy Markdown
Member

@alcuadrado alcuadrado commented Apr 12, 2026

This PR updates the test solidity task so that it works with and without splitTestsCompilation. Just like the build one, this is one of the most complex PRs, product-wise.

Some failures in external plugins are expected, mainly from typechain

@alcuadrado alcuadrado requested a review from Copilot April 12, 2026 22:11
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 12, 2026

⚠️ No Changeset found

Latest commit: 3dd4360

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

Updates Hardhat’s Solidity test runner (hardhat test solidity) to behave correctly in both unified and split compilation modes, aligning test compilation/execution with the new splitTestsCompilation setting and introducing clearer error reporting for invalid/uncached selections.

Changes:

  • Add mode-independent validation that selected testFiles are actually Solidity tests, and introduce dedicated errors for “not tests” and “not compiled with --no-compile”.
  • Update unified mode to compile selectively via a single build({ files: testFiles }) and derive runnable test roots from the build result.
  • Adjust the Solidity test runner streaming implementation to use a native Node.js Readable, and expand internal test coverage/fixtures.

Reviewed changes

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

Show a summary per file
File Description
SPLIT_TESTS_COMPILATION_SPEC.md Updates the spec for Solidity test runner semantics across split/unified modes
packages/hardhat/test/internal/builtin-plugins/solidity-test/task-action.ts Extends tests to cover new validation/errors and unified-mode behavior
packages/hardhat/test/fixture-projects/solidity-test/test/contracts/deprecated/NormalTest.t.sol Adds fixture test for non-deprecated behavior
packages/hardhat/test/fixture-projects/solidity-test/test/contracts/deprecated/DeprecatedTestFail.t.sol Adds fixture test that triggers deprecated testFail* warning
packages/hardhat/src/internal/builtin-plugins/solidity/tasks/build.ts Minor refactor to simplify root path normalization
packages/hardhat/src/internal/builtin-plugins/solidity-test/task-action.ts Implements new unified-mode build behavior, early validation, and --no-compile checks
packages/hardhat/src/internal/builtin-plugins/solidity-test/runner.ts Switches test event streaming to a native Node.js Readable
packages/hardhat-errors/src/descriptors.ts Adds new Solidity test runner error descriptors (814, 815)
cspell.config.mts Ignores fixture-project build outputs (artifacts/cache) for spellchecking

Comment thread SPLIT_TESTS_COMPILATION_SPEC.md
Comment thread SPLIT_TESTS_COMPILATION_SPEC.md
Comment thread packages/hardhat/src/internal/builtin-plugins/solidity-test/task-action.ts Outdated
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-5 branch from ec3246e to 4b0535f Compare April 13, 2026 09:35
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-6 branch 2 times, most recently from 50c9d99 to d787c3d Compare April 13, 2026 10:32
@alcuadrado alcuadrado force-pushed the dont-split-compilations-phase-5 branch 2 times, most recently from 39c9605 to a778847 Compare April 13, 2026 11:07
@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-5 branch from a778847 to cfb761c Compare April 13, 2026 11:21
@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-5 branch from cfb761c to 908198d Compare April 13, 2026 11:39
@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-5 branch from 908198d to 3e8e721 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 8 out of 8 changed files in this pull request and generated 4 comments.

Comment thread SPLIT_TESTS_COMPILATION_SPEC.md
Comment thread packages/hardhat/src/internal/builtin-plugins/solidity-test/task-action.ts Outdated
Comment thread packages/hardhat-errors/src/descriptors.ts Outdated
@alcuadrado alcuadrado requested a review from Copilot April 13, 2026 12:15
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 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread SPLIT_TESTS_COMPILATION_SPEC.md 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 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread packages/hardhat-errors/src/descriptors.ts
* a draft that may change in the future.
*
* TODO: Once the signature is finalized, give feedback to the EDR team.
* Important TODO: Transform this into an AsyncGenerator<SuiteResult, SolidityTestResult, void>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should create an issue to track this, otherwise it's likely to get forgotten. It would be good to clean this up while it's still fresh in our minds

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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


async function loadArtifacts(
solidity: SolidityBuildSystem,
scopes: Array<"contracts" | "tests">,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why not BuildScope[]?


const verbosity = hre.globalOptions.verbosity;
const resolvedTestFilesArgument = testFiles.map((f) =>
resolveFromRoot(process.cwd(), f),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should we use hre.config.paths.root instead of process.cwd() here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This has to be aligned with build. I'll add a comment about it.

Base automatically changed from dont-split-compilations-phase-5 to dont-split-compilations April 16, 2026 16:33
@alcuadrado alcuadrado merged commit 5697e12 into dont-split-compilations Apr 16, 2026
250 of 259 checks passed
@alcuadrado alcuadrado deleted the dont-split-compilations-phase-6 branch April 16, 2026 16:36
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