Skip to content

Remove timeout option for solidity tests#8115

Merged
alcuadrado merged 2 commits intomainfrom
remove-timeout-solidity-tests
Apr 10, 2026
Merged

Remove timeout option for solidity tests#8115
alcuadrado merged 2 commits intomainfrom
remove-timeout-solidity-tests

Conversation

@ChristopherDedominici
Copy link
Copy Markdown
Contributor

@ChristopherDedominici ChristopherDedominici commented Apr 8, 2026

Fixes: #7750

PR to update website docs: NomicFoundation/hardhat-website#250

⚠️ This is a breaking change

Copilot AI review requested due to automatic review settings April 8, 2026 12:04
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 8, 2026

🦋 Changeset detected

Latest commit: 935a043

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@nomicfoundation/hardhat-errors Patch
hardhat Patch

Not sure what this means? Click here to learn what changesets are.

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

@ChristopherDedominici ChristopherDedominici added type:breaking-change Breaking change in public API and removed status:triaging labels Apr 8, 2026
@ChristopherDedominici ChristopherDedominici moved this from Backlog to In Progress in Hardhat Apr 8, 2026
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 removes the test.solidity.timeout option from Hardhat’s Solidity test configuration, simplifying the API by dropping a misleading “whole-run timeout” that doesn’t behave like a per-test timeout (per issue #7750).

Changes:

  • Remove timeout from Solidity test config types and Zod config schema.
  • Remove runner/task plumbing that implemented the whole-run timeout behavior.
  • Update config validation and config-merge tests to use an alternative config key (isolate) instead of timeout.

Reviewed changes

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

Show a summary per file
File Description
packages/hardhat/test/internal/builtin-plugins/test/config.ts Updates the “preserve existing config” test to use isolate instead of timeout.
packages/hardhat/test/internal/builtin-plugins/solidity-test/config-validation.ts Updates Solidity test config validation tests to validate isolate and its type error message.
packages/hardhat/src/internal/builtin-plugins/solidity-test/type-extensions.ts Removes timeout?: number from the Solidity test config type extensions.
packages/hardhat/src/internal/builtin-plugins/solidity-test/task-action.ts Stops deriving/passing runner timeout options into the Solidity test runner.
packages/hardhat/src/internal/builtin-plugins/solidity-test/runner.ts Removes RunOptions and the timeout timer/error path from the runner implementation.
packages/hardhat/src/internal/builtin-plugins/solidity-test/helpers.ts Removes the config→run-options helper (previously just forwarded config).
packages/hardhat/src/internal/builtin-plugins/solidity-test/config.ts Removes timeout from the Zod schema for test.solidity.
packages/hardhat-errors/src/descriptors.ts Marks the RUNNER_TIMEOUT error descriptor with a deprecation comment.
Comments suppressed due to low confidence (1)

packages/hardhat/src/internal/builtin-plugins/solidity-test/config.ts:34

  • Removing timeout from the Zod schema here doesn’t actually prevent users from continuing to set test.solidity.timeout: Zod’s default z.object behavior won’t error on unknown keys, and resolveSolidityTestUserConfig later spreads ...userConfig.test?.solidity into the resolved config (so hre.config.test.solidity.timeout can still exist at runtime, even though it no longer does anything). To fully remove the option (per the PR goal), either explicitly omit timeout during config resolution, or make the relevant schema strict and surface a clear config validation error when timeout is present.
const solidityTestUserConfigType = z.object({
  fsPermissions: z
    .object({
      readWriteFile: z.array(z.string()).optional(),
      readFile: z.array(z.string()).optional(),

Comment on lines 1099 to 1102
RUNNER_TIMEOUT: {
// [DEPRECATED]
number: 801,
messageTemplate: `Runner timed out after {duration} ms.
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

Now that the runner timeout option is removed and RUNNER_TIMEOUT appears to be unreachable, consider either removing this descriptor entry (if error codes aren’t part of a stable external API) or updating the actual message/website description to indicate deprecation. A standalone // [DEPRECATED] comment is easy to miss and isn’t consistent with most of the descriptors file.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

@ChristopherDedominici ChristopherDedominici Apr 8, 2026

Choose a reason for hiding this comment

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

Not sure on how to deprecate a DESCRIPTOR, do we have a standard process?

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 can't remove them, because this generates the website, and older versions link to it.

I think what you did here makes sense.

testFunctionOverrides?: TestFunctionOverride[];
}

export function solidityTestConfigToRunOptions(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

used only to get the timeout, so now it is no longer needed

@ChristopherDedominici ChristopherDedominici moved this from In Progress to In Review in Hardhat Apr 8, 2026
@alcuadrado alcuadrado added this pull request to the merge queue Apr 10, 2026
Merged via the queue into main with commit 3518439 Apr 10, 2026
262 of 269 checks passed
@alcuadrado alcuadrado deleted the remove-timeout-solidity-tests branch April 10, 2026 17:44
@github-project-automation github-project-automation Bot moved this from In Review to Done in Hardhat Apr 10, 2026
@github-actions github-actions Bot mentioned this pull request Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no peer bump needed type:breaking-change Breaking change in public API

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Remove timeout option for solidity tests

5 participants