Add splitTestsCompilation solidity setting (6): Solidity test runner updates#8133
Conversation
|
There was a problem hiding this comment.
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
testFilesare 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 |
ec3246e to
4b0535f
Compare
50c9d99 to
d787c3d
Compare
39c9605 to
a778847
Compare
d787c3d to
5a1a3d2
Compare
a778847 to
cfb761c
Compare
5a1a3d2 to
7fb9a86
Compare
cfb761c to
908198d
Compare
7fb9a86 to
bf63fb6
Compare
908198d to
3e8e721
Compare
bf63fb6 to
0460272
Compare
| * 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> |
There was a problem hiding this comment.
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
|
|
||
| async function loadArtifacts( | ||
| solidity: SolidityBuildSystem, | ||
| scopes: Array<"contracts" | "tests">, |
|
|
||
| const verbosity = hre.globalOptions.verbosity; | ||
| const resolvedTestFilesArgument = testFiles.map((f) => | ||
| resolveFromRoot(process.cwd(), f), |
There was a problem hiding this comment.
should we use hre.config.paths.root instead of process.cwd() here?
There was a problem hiding this comment.
This has to be aligned with build. I'll add a comment about it.
This PR updates the
test soliditytask so that it works with and withoutsplitTestsCompilation. Just like thebuildone, this is one of the most complex PRs, product-wise.Some failures in external plugins are expected, mainly from typechain