diff --git a/.changeset/long-toes-deny.md b/.changeset/long-toes-deny.md new file mode 100644 index 0000000000..448c503e67 --- /dev/null +++ b/.changeset/long-toes-deny.md @@ -0,0 +1,5 @@ +--- +"hardhat": patch +--- + +Use default value for rpcCachePath when running solidity tests diff --git a/v-next/hardhat/src/internal/builtin-plugins/solidity-test/config.ts b/v-next/hardhat/src/internal/builtin-plugins/solidity-test/config.ts index 718006067d..e714269d5b 100644 --- a/v-next/hardhat/src/internal/builtin-plugins/solidity-test/config.ts +++ b/v-next/hardhat/src/internal/builtin-plugins/solidity-test/config.ts @@ -2,6 +2,8 @@ import type { HardhatUserConfig } from "../../../config.js"; import type { HardhatConfig } from "../../../types/config.js"; import type { HardhatUserConfigValidationError } from "../../../types/hooks.js"; +import path from "node:path"; + import { isObject } from "@nomicfoundation/hardhat-utils/lang"; import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path"; import { @@ -121,6 +123,16 @@ export async function resolveSolidityTestUserConfig( testsPath = typeof testsPath === "object" ? testsPath.solidity : testsPath; testsPath ??= "test"; + const defaultRpcCachePath = path.join( + resolvedConfig.paths.cache, + "edr-cache", + ); + + const solidityTest = { + rpcCachePath: defaultRpcCachePath, + ...userConfig.solidityTest, + }; + return { ...resolvedConfig, paths: { @@ -130,6 +142,6 @@ export async function resolveSolidityTestUserConfig( solidity: resolveFromRoot(resolvedConfig.paths.root, testsPath), }, }, - solidityTest: userConfig.solidityTest ?? {}, + solidityTest, }; }