hardhat 3.11.1 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -2
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.js +2 -1
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js +2 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js +3 -3
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js +2 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +3 -3
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts +17 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js +18 -4
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/hhu/types.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-connection.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-connection.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js +9 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.js +10 -5
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-results.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-results.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +2 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.js +2 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/types.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +2 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +3 -2
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.js +6 -0
- package/dist/src/internal/builtin-plugins/solidity-test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/index.js +4 -2
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/parsing.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/parsing.js +2 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/parsing.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.js +2 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/runner.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/runner.js +2 -1
- package/dist/src/internal/builtin-plugins/solidity-test/runner.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +6 -3
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/index.js +6 -0
- package/dist/src/internal/builtin-plugins/test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js +7 -2
- package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
- package/dist/src/internal/cli/error-handler.js +2 -1
- package/dist/src/internal/cli/error-handler.js.map +1 -1
- package/dist/src/internal/cli/init/template.d.ts.map +1 -1
- package/dist/src/internal/cli/init/template.js +15 -1
- package/dist/src/internal/cli/init/template.js.map +1 -1
- package/dist/src/internal/cli/main.d.ts.map +1 -1
- package/dist/src/internal/cli/main.js +2 -1
- package/dist/src/internal/cli/main.js.map +1 -1
- package/dist/src/internal/cli/telemetry/analytics/analytics.d.ts +1 -0
- package/dist/src/internal/cli/telemetry/analytics/analytics.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/analytics/analytics.js +9 -0
- package/dist/src/internal/cli/telemetry/analytics/analytics.js.map +1 -1
- package/dist/src/internal/cli/telemetry/analytics/types.d.ts +5 -0
- package/dist/src/internal/cli/telemetry/analytics/types.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/anonymizer.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/anonymizer.js.map +1 -1
- package/dist/src/internal/core/config.d.ts.map +1 -1
- package/dist/src/internal/core/config.js +2 -1
- package/dist/src/internal/core/config.js.map +1 -1
- package/dist/src/internal/core/configuration-variables.d.ts.map +1 -1
- package/dist/src/internal/core/configuration-variables.js +7 -0
- package/dist/src/internal/core/configuration-variables.js.map +1 -1
- package/dist/src/internal/core/hook-manager.d.ts.map +1 -1
- package/dist/src/internal/core/hook-manager.js.map +1 -1
- package/dist/src/internal/core/hre.d.ts.map +1 -1
- package/dist/src/internal/core/hre.js.map +1 -1
- package/dist/src/internal/core/lazy-user-interruptions.d.ts.map +1 -1
- package/dist/src/internal/core/lazy-user-interruptions.js +2 -1
- package/dist/src/internal/core/lazy-user-interruptions.js.map +1 -1
- package/dist/src/internal/core/tasks/builders.d.ts.map +1 -1
- package/dist/src/internal/core/tasks/builders.js.map +1 -1
- package/dist/src/internal/core/tasks/resolved-task.d.ts.map +1 -1
- package/dist/src/internal/core/tasks/resolved-task.js +2 -1
- package/dist/src/internal/core/tasks/resolved-task.js.map +1 -1
- package/dist/src/internal/core/tasks/task-manager.d.ts.map +1 -1
- package/dist/src/internal/core/tasks/task-manager.js +2 -1
- package/dist/src/internal/core/tasks/task-manager.js.map +1 -1
- package/dist/src/internal/core/tasks/validations.d.ts.map +1 -1
- package/dist/src/internal/core/tasks/validations.js +2 -1
- package/dist/src/internal/core/tasks/validations.js.map +1 -1
- package/dist/src/internal/core/user-interruptions.d.ts.map +1 -1
- package/dist/src/internal/core/user-interruptions.js.map +1 -1
- package/dist/src/internal/global-hre-instance.d.ts.map +1 -1
- package/dist/src/internal/global-hre-instance.js.map +1 -1
- package/dist/src/types/artifacts.d.ts.map +1 -1
- package/dist/src/types/solidity/build-system.d.ts.map +1 -1
- package/dist/src/types/solidity/build-system.js.map +1 -1
- package/dist/src/types/solidity/errors.d.ts.map +1 -1
- package/dist/src/types/solidity/errors.js.map +1 -1
- package/dist/src/types/tasks.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/internal/builtin-plugins/artifacts/artifact-manager.ts +2 -2
- package/src/internal/builtin-plugins/artifacts/hook-handlers/hre.ts +3 -5
- package/src/internal/builtin-plugins/coverage/hook-handlers/hre.ts +3 -5
- package/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.ts +3 -3
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts +3 -5
- package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +3 -3
- package/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.ts +32 -5
- package/src/internal/builtin-plugins/hhu/types.ts +1 -2
- package/src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.ts +4 -6
- package/src/internal/builtin-plugins/network-manager/edr/edr-constants.ts +1 -2
- package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +2 -3
- package/src/internal/builtin-plugins/network-manager/hook-handlers/hre.ts +2 -3
- package/src/internal/builtin-plugins/network-manager/network-connection.ts +1 -2
- package/src/internal/builtin-plugins/network-manager/network-manager.ts +11 -1
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.ts +10 -9
- package/src/internal/builtin-plugins/network-manager/type-extensions/config.ts +6 -14
- package/src/internal/builtin-plugins/solidity/build-results.ts +1 -2
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +2 -1
- package/src/internal/builtin-plugins/solidity/build-system/compilation-job.ts +2 -1
- package/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.ts +1 -3
- package/src/internal/builtin-plugins/solidity/build-system/resolver/types.ts +1 -2
- package/src/internal/builtin-plugins/solidity/config.ts +2 -4
- package/src/internal/builtin-plugins/solidity/hook-handlers/hre.ts +1 -2
- package/src/internal/builtin-plugins/solidity/type-extensions.ts +16 -14
- package/src/internal/builtin-plugins/solidity-test/helpers.ts +5 -1
- package/src/internal/builtin-plugins/solidity-test/index.ts +6 -0
- package/src/internal/builtin-plugins/solidity-test/inline-config/index.ts +4 -2
- package/src/internal/builtin-plugins/solidity-test/inline-config/parsing.ts +2 -1
- package/src/internal/builtin-plugins/solidity-test/inline-config/validation.ts +2 -1
- package/src/internal/builtin-plugins/solidity-test/reporter.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/runner.ts +2 -1
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +7 -3
- package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +1 -2
- package/src/internal/builtin-plugins/test/index.ts +6 -0
- package/src/internal/builtin-plugins/test/task-action.ts +10 -2
- package/src/internal/cli/error-handler.ts +2 -3
- package/src/internal/cli/init/template.ts +16 -1
- package/src/internal/cli/main.ts +5 -4
- package/src/internal/cli/telemetry/analytics/analytics.ts +13 -0
- package/src/internal/cli/telemetry/analytics/types.ts +6 -0
- package/src/internal/cli/telemetry/error-reporter/global-error-handlers.ts +2 -2
- package/src/internal/cli/telemetry/sentry/anonymizer.ts +2 -4
- package/src/internal/core/config.ts +2 -1
- package/src/internal/core/configuration-variables.ts +9 -3
- package/src/internal/core/hook-manager.ts +2 -4
- package/src/internal/core/hre.ts +1 -3
- package/src/internal/core/lazy-user-interruptions.ts +3 -5
- package/src/internal/core/tasks/builders.ts +8 -17
- package/src/internal/core/tasks/resolved-task.ts +2 -1
- package/src/internal/core/tasks/task-manager.ts +2 -1
- package/src/internal/core/tasks/validations.ts +2 -1
- package/src/internal/core/user-interruptions.ts +1 -3
- package/src/internal/global-hre-instance.ts +1 -2
- package/src/types/artifacts.ts +1 -2
- package/src/types/solidity/build-system.ts +8 -17
- package/src/types/solidity/errors.ts +3 -6
- package/src/types/tasks.ts +5 -11
- package/templates/01-node-test-runner-viem/package.json +1 -1
- package/templates/02-mocha-ethers/package.json +1 -1
- package/templates/03-minimal/package.json +1 -1
|
@@ -33,6 +33,7 @@ interface GasAnalyticsTestActionArguments {
|
|
|
33
33
|
snapshotCheck: boolean;
|
|
34
34
|
// Forwarded from the base `test solidity` task; used to detect scoped runs.
|
|
35
35
|
grep?: string;
|
|
36
|
+
grepExclude?: string;
|
|
36
37
|
testFiles?: string[];
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -77,11 +78,11 @@ const runSolidityTests: TaskOverrideActionFunction<
|
|
|
77
78
|
rootPath,
|
|
78
79
|
suiteResults,
|
|
79
80
|
);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
logSnapshotCheckResult(
|
|
82
|
+
snapshotCheckResult,
|
|
83
|
+
console.log,
|
|
84
|
+
isFilteredRun(args),
|
|
85
|
+
);
|
|
85
86
|
snapshotCheckPassed =
|
|
86
87
|
snapshotCheckResult.functionGasSnapshotsCheck.passed &&
|
|
87
88
|
snapshotCheckResult.snapshotCheatcodesCheck.passed;
|
|
@@ -94,6 +95,32 @@ const runSolidityTests: TaskOverrideActionFunction<
|
|
|
94
95
|
return superResult;
|
|
95
96
|
};
|
|
96
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Whether a `test solidity` run is scoped to a subset of tests (via `--grep`,
|
|
100
|
+
* `--grep-exclude`, or explicit files). On a scoped run, added/missing
|
|
101
|
+
* snapshots are artifacts of the filter rather than real differences, so they
|
|
102
|
+
* aren't reported.
|
|
103
|
+
*
|
|
104
|
+
* An explicit empty pattern (e.g. `--grep ""`) is normalized to "no filter" by
|
|
105
|
+
* the base task before it runs EDR (see `solidity-test/helpers.ts`), so it runs
|
|
106
|
+
* the full suite; treat it as unfiltered here so real differences still
|
|
107
|
+
* surface. (An omitted option already arrives as `undefined`.)
|
|
108
|
+
*/
|
|
109
|
+
export function isFilteredRun(args: {
|
|
110
|
+
grep?: string;
|
|
111
|
+
grepExclude?: string;
|
|
112
|
+
testFiles?: string[];
|
|
113
|
+
}): boolean {
|
|
114
|
+
const hasPattern = (pattern?: string): boolean =>
|
|
115
|
+
pattern !== undefined && pattern !== "";
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
hasPattern(args.grep) ||
|
|
119
|
+
hasPattern(args.grepExclude) ||
|
|
120
|
+
(args.testFiles?.length ?? 0) > 0
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
97
124
|
export async function handleSnapshot(
|
|
98
125
|
basePath: string,
|
|
99
126
|
suiteResults: SuiteResult[],
|
|
@@ -23,8 +23,7 @@ export interface UtilsHardhatRuntimeEnvironment {
|
|
|
23
23
|
* ({@link UtilsHardhatRuntimeEnvironment}) plus the `config` that
|
|
24
24
|
* `TaskManagerImplementation` needs to build the task map.
|
|
25
25
|
*/
|
|
26
|
-
export interface FakeHhuHardhatRuntimeEnvironment
|
|
27
|
-
extends UtilsHardhatRuntimeEnvironment {
|
|
26
|
+
export interface FakeHhuHardhatRuntimeEnvironment extends UtilsHardhatRuntimeEnvironment {
|
|
28
27
|
config: Pick<HardhatRuntimeEnvironment["config"], "tasks" | "plugins">;
|
|
29
28
|
}
|
|
30
29
|
|
|
@@ -61,17 +61,15 @@ async function deriveKeyFromMnemonicAndPath(
|
|
|
61
61
|
const trimmedMnemonic = mnemonic.trim();
|
|
62
62
|
|
|
63
63
|
if (mnemonicToSeedSync === undefined) {
|
|
64
|
-
const { mnemonicToSeedSync: importedMnemonicToSeedSync } =
|
|
65
|
-
"ethereum-cryptography/bip39"
|
|
66
|
-
);
|
|
64
|
+
const { mnemonicToSeedSync: importedMnemonicToSeedSync } =
|
|
65
|
+
await import("ethereum-cryptography/bip39");
|
|
67
66
|
|
|
68
67
|
mnemonicToSeedSync = importedMnemonicToSeedSync;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
if (HDKey === undefined) {
|
|
72
|
-
const { HDKey: ImportedHDKey } =
|
|
73
|
-
"ethereum-cryptography/hdkey"
|
|
74
|
-
);
|
|
71
|
+
const { HDKey: ImportedHDKey } =
|
|
72
|
+
await import("ethereum-cryptography/hdkey");
|
|
75
73
|
|
|
76
74
|
HDKey = ImportedHDKey;
|
|
77
75
|
}
|
|
@@ -10,8 +10,7 @@ export const EDR_NETWORK_DEFAULT_COINBASE =
|
|
|
10
10
|
|
|
11
11
|
export const DEFAULT_EDR_NETWORK_BLOCK_GAS_LIMIT = 60_000_000n;
|
|
12
12
|
|
|
13
|
-
interface EdrNetworkDefaultHDAccountsConfigParams
|
|
14
|
-
extends DefaultHDAccountsConfigParams {
|
|
13
|
+
interface EdrNetworkDefaultHDAccountsConfigParams extends DefaultHDAccountsConfigParams {
|
|
15
14
|
mnemonic: string;
|
|
16
15
|
accountsBalance: bigint;
|
|
17
16
|
}
|
|
@@ -167,9 +167,8 @@ export class EdrProvider extends BaseProvider {
|
|
|
167
167
|
|
|
168
168
|
let traceOutput: TraceOutputManager | undefined;
|
|
169
169
|
if (tracesEnabled) {
|
|
170
|
-
const { TraceOutputManager: TraceOutputManagerImpl } =
|
|
171
|
-
"./utils/trace-output.js"
|
|
172
|
-
);
|
|
170
|
+
const { TraceOutputManager: TraceOutputManagerImpl } =
|
|
171
|
+
await import("./utils/trace-output.js");
|
|
173
172
|
traceOutput = new TraceOutputManagerImpl(
|
|
174
173
|
printLineFn,
|
|
175
174
|
connectionId,
|
|
@@ -63,9 +63,8 @@ async function createNetworkManager(
|
|
|
63
63
|
hre: HardhatRuntimeEnvironment,
|
|
64
64
|
context: HookContext,
|
|
65
65
|
): Promise<NetworkManager> {
|
|
66
|
-
const { NetworkManagerImplementation } =
|
|
67
|
-
"../network-manager.js"
|
|
68
|
-
);
|
|
66
|
+
const { NetworkManagerImplementation } =
|
|
67
|
+
await import("../network-manager.js");
|
|
69
68
|
|
|
70
69
|
return new NetworkManagerImplementation(
|
|
71
70
|
hre.globalOptions.network !== undefined
|
|
@@ -8,8 +8,7 @@ export type CloseConnectionFunction<ChainTypeT extends ChainType | string> = (
|
|
|
8
8
|
|
|
9
9
|
export class NetworkConnectionImplementation<
|
|
10
10
|
ChainTypeT extends ChainType | string,
|
|
11
|
-
> implements NetworkConnection<ChainTypeT>
|
|
12
|
-
{
|
|
11
|
+
> implements NetworkConnection<ChainTypeT> {
|
|
13
12
|
public readonly id: number;
|
|
14
13
|
public readonly networkName: string;
|
|
15
14
|
public readonly networkConfig: Readonly<NetworkConfig>;
|
|
@@ -32,6 +32,7 @@ import { exists, readBinaryFile } from "@nomicfoundation/hardhat-utils/fs";
|
|
|
32
32
|
import { deepMerge } from "@nomicfoundation/hardhat-utils/lang";
|
|
33
33
|
import { AsyncMutex } from "@nomicfoundation/hardhat-utils/synchronization";
|
|
34
34
|
|
|
35
|
+
import { sendNetworkAnalytics } from "../../cli/telemetry/analytics/analytics.js";
|
|
35
36
|
import { resolveUserConfigToHardhatConfig } from "../../core/hre.js";
|
|
36
37
|
import { isSupportedChainType } from "../../edr/chain-type.js";
|
|
37
38
|
import { JsonRpcServerImplementation } from "../node/json-rpc/server.js";
|
|
@@ -73,6 +74,8 @@ export class NetworkManagerImplementation implements NetworkManager {
|
|
|
73
74
|
Map<string, NetworkConnection<ChainType | string>>
|
|
74
75
|
>();
|
|
75
76
|
|
|
77
|
+
readonly #chainTypesWithSentAnalytics = new Set<string>();
|
|
78
|
+
|
|
76
79
|
constructor(
|
|
77
80
|
defaultNetwork: string,
|
|
78
81
|
defaultChainType: DefaultChainType,
|
|
@@ -124,6 +127,13 @@ export class NetworkManagerImplementation implements NetworkManager {
|
|
|
124
127
|
),
|
|
125
128
|
);
|
|
126
129
|
|
|
130
|
+
if (!this.#chainTypesWithSentAnalytics.has(networkConnection.chainType)) {
|
|
131
|
+
this.#chainTypesWithSentAnalytics.add(networkConnection.chainType);
|
|
132
|
+
// Fire-and-forget: analytics must never delay or break connection
|
|
133
|
+
// creation
|
|
134
|
+
void sendNetworkAnalytics(networkConnection.chainType).catch(() => {});
|
|
135
|
+
}
|
|
136
|
+
|
|
127
137
|
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
128
138
|
-- Cast to NetworkConnection<ChainTypeT> because we know it's valid */
|
|
129
139
|
return networkConnection as NetworkConnection<ChainTypeT>;
|
|
@@ -624,7 +634,7 @@ export class NetworkManagerImplementation implements NetworkManager {
|
|
|
624
634
|
const networkName =
|
|
625
635
|
typeof networkOrParams === "string"
|
|
626
636
|
? networkOrParams
|
|
627
|
-
: networkOrParams?.network ?? this.#defaultNetwork;
|
|
637
|
+
: (networkOrParams?.network ?? this.#defaultNetwork);
|
|
628
638
|
|
|
629
639
|
const networkConfig = this.#networkConfigs[networkName];
|
|
630
640
|
|
|
@@ -130,9 +130,8 @@ export class LocalAccountsHandler extends ChainId implements RequestHandler {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
if (microEthSignerTypedData === undefined) {
|
|
133
|
-
microEthSignerTypedData =
|
|
134
|
-
"micro-eth-signer/typed-data"
|
|
135
|
-
);
|
|
133
|
+
microEthSignerTypedData =
|
|
134
|
+
await import("micro-eth-signer/typed-data");
|
|
136
135
|
}
|
|
137
136
|
|
|
138
137
|
const privateKey = await this.#getPrivateKeyForAddress(address);
|
|
@@ -155,14 +154,14 @@ export class LocalAccountsHandler extends ChainId implements RequestHandler {
|
|
|
155
154
|
if (data !== undefined) {
|
|
156
155
|
if (address === undefined) {
|
|
157
156
|
throw new HardhatError(
|
|
158
|
-
HardhatError.ERRORS.CORE.NETWORK
|
|
157
|
+
HardhatError.ERRORS.CORE.NETWORK
|
|
158
|
+
.PERSONALSIGN_MISSING_ADDRESS_PARAM,
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
if (microEthSignerTypedData === undefined) {
|
|
163
|
-
microEthSignerTypedData =
|
|
164
|
-
"micro-eth-signer/typed-data"
|
|
165
|
-
);
|
|
163
|
+
microEthSignerTypedData =
|
|
164
|
+
await import("micro-eth-signer/typed-data");
|
|
166
165
|
}
|
|
167
166
|
|
|
168
167
|
const privateKey = await this.#getPrivateKeyForAddress(address);
|
|
@@ -193,7 +192,8 @@ export class LocalAccountsHandler extends ChainId implements RequestHandler {
|
|
|
193
192
|
typedMessage = JSON.parse(data);
|
|
194
193
|
} catch {
|
|
195
194
|
throw new HardhatError(
|
|
196
|
-
HardhatError.ERRORS.CORE.NETWORK
|
|
195
|
+
HardhatError.ERRORS.CORE.NETWORK
|
|
196
|
+
.ETHSIGN_TYPED_DATA_V4_INVALID_DATA_PARAM,
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
@@ -403,7 +403,8 @@ export class LocalAccountsHandler extends ChainId implements RequestHandler {
|
|
|
403
403
|
txData.data === undefined
|
|
404
404
|
) {
|
|
405
405
|
throw new HardhatError(
|
|
406
|
-
HardhatError.ERRORS.CORE.NETWORK
|
|
406
|
+
HardhatError.ERRORS.CORE.NETWORK
|
|
407
|
+
.DATA_FIELD_CANNOT_BE_NULL_WITH_NULL_ADDRESS,
|
|
407
408
|
);
|
|
408
409
|
}
|
|
409
410
|
|
|
@@ -20,8 +20,7 @@ declare module "../../../../types/config.js" {
|
|
|
20
20
|
|
|
21
21
|
export interface HardforkHistoryUserConfig {
|
|
22
22
|
[hardforkName: string]:
|
|
23
|
-
|
|
|
24
|
-
| ActivationTimestampUserConfig;
|
|
23
|
+
ActivationBlockNumberUserConfig | ActivationTimestampUserConfig;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
export interface ActivationBlockNumberUserConfig {
|
|
@@ -64,8 +63,7 @@ declare module "../../../../types/config.js" {
|
|
|
64
63
|
// Ideally we use Partial<Omit<NetworkUserConfig, "type">> but omit breaks
|
|
65
64
|
// discriminated unions. See https://github.com/microsoft/TypeScript/issues/31501
|
|
66
65
|
export type NetworkConfigOverride =
|
|
67
|
-
|
|
|
68
|
-
| EdrNetworkConfigOverride;
|
|
66
|
+
HttpNetworkConfigOverride | EdrNetworkConfigOverride;
|
|
69
67
|
|
|
70
68
|
export interface HttpNetworkUserConfig {
|
|
71
69
|
type: "http";
|
|
@@ -84,9 +82,7 @@ declare module "../../../../types/config.js" {
|
|
|
84
82
|
}
|
|
85
83
|
|
|
86
84
|
export type HttpNetworkAccountsUserConfig =
|
|
87
|
-
|
|
88
|
-
| SensitiveString[]
|
|
89
|
-
| HttpNetworkHDAccountsUserConfig;
|
|
85
|
+
"remote" | SensitiveString[] | HttpNetworkHDAccountsUserConfig;
|
|
90
86
|
|
|
91
87
|
export interface HttpNetworkHDAccountsUserConfig {
|
|
92
88
|
mnemonic: SensitiveString;
|
|
@@ -127,8 +123,7 @@ declare module "../../../../types/config.js" {
|
|
|
127
123
|
}
|
|
128
124
|
|
|
129
125
|
export type EdrNetworkAccountsUserConfig =
|
|
130
|
-
|
|
131
|
-
| EdrNetworkHDAccountsUserConfig;
|
|
126
|
+
EdrNetworkAccountUserConfig[] | EdrNetworkHDAccountsUserConfig;
|
|
132
127
|
|
|
133
128
|
export interface EdrNetworkAccountUserConfig {
|
|
134
129
|
balance: string | bigint;
|
|
@@ -230,9 +225,7 @@ declare module "../../../../types/config.js" {
|
|
|
230
225
|
}
|
|
231
226
|
|
|
232
227
|
export type HttpNetworkAccountsConfig =
|
|
233
|
-
|
|
234
|
-
| ResolvedConfigurationVariable[]
|
|
235
|
-
| HttpNetworkHDAccountsConfig;
|
|
228
|
+
"remote" | ResolvedConfigurationVariable[] | HttpNetworkHDAccountsConfig;
|
|
236
229
|
|
|
237
230
|
export interface HttpNetworkHDAccountsConfig {
|
|
238
231
|
mnemonic: ResolvedConfigurationVariable;
|
|
@@ -273,8 +266,7 @@ declare module "../../../../types/config.js" {
|
|
|
273
266
|
}
|
|
274
267
|
|
|
275
268
|
export type EdrNetworkAccountsConfig =
|
|
276
|
-
|
|
277
|
-
| EdrNetworkHDAccountsConfig;
|
|
269
|
+
EdrNetworkAccountConfig[] | EdrNetworkHDAccountsConfig;
|
|
278
270
|
|
|
279
271
|
export interface EdrNetworkAccountConfig {
|
|
280
272
|
balance: bigint;
|
|
@@ -10,8 +10,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
|
10
10
|
import { FileBuildResultType } from "../../../types/solidity.js";
|
|
11
11
|
|
|
12
12
|
type SolidityBuildResults =
|
|
13
|
-
|
|
14
|
-
| CompilationJobCreationError;
|
|
13
|
+
Map<string, FileBuildResult> | CompilationJobCreationError;
|
|
15
14
|
type SuccessfulSolidityBuildResults = Map<
|
|
16
15
|
string,
|
|
17
16
|
Exclude<FileBuildResult, FailedFileBuildResult>
|
|
@@ -1364,7 +1364,8 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
1364
1364
|
[partialCompilerConfig],
|
|
1365
1365
|
async () => {
|
|
1366
1366
|
throw new HardhatError(
|
|
1367
|
-
HardhatError.ERRORS.CORE.SOLIDITY
|
|
1367
|
+
HardhatError.ERRORS.CORE.SOLIDITY
|
|
1368
|
+
.BUILD_INFO_COMPILER_TYPE_NOT_HANDLED,
|
|
1368
1369
|
{
|
|
1369
1370
|
compilerType,
|
|
1370
1371
|
version: buildInfo.solcVersion,
|
|
@@ -110,7 +110,8 @@ export class CompilationJobImplementation implements CompilationJob {
|
|
|
110
110
|
]) {
|
|
111
111
|
if (expectedParamValue !== actualParamValue) {
|
|
112
112
|
throw new HardhatError(
|
|
113
|
-
HardhatError.ERRORS.CORE.HOOKS
|
|
113
|
+
HardhatError.ERRORS.CORE.HOOKS
|
|
114
|
+
.UNEXPECTED_HOOK_PARAM_MODIFICATION,
|
|
114
115
|
{
|
|
115
116
|
hookCategoryName: "solidity",
|
|
116
117
|
hookName: "preprocessProjectFileBeforeBuilding",
|
package/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.ts
CHANGED
|
@@ -83,9 +83,7 @@ export function isResolvedUserRemapping(
|
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
export class RemappedNpmPackagesGraphImplementation
|
|
87
|
-
implements RemappedNpmPackagesGraph
|
|
88
|
-
{
|
|
86
|
+
export class RemappedNpmPackagesGraphImplementation implements RemappedNpmPackagesGraph {
|
|
89
87
|
/**
|
|
90
88
|
* The Hardhat project itself.
|
|
91
89
|
*/
|
|
@@ -77,8 +77,7 @@ export interface ResolvedNpmUserRemapping extends BaseUserRemapping, Remapping {
|
|
|
77
77
|
* A resolved user remapping.
|
|
78
78
|
*/
|
|
79
79
|
export type ResolvedUserRemapping =
|
|
80
|
-
|
|
|
81
|
-
| ResolvedNpmUserRemapping;
|
|
80
|
+
LocalUserRemapping | ResolvedNpmUserRemapping;
|
|
82
81
|
|
|
83
82
|
/**
|
|
84
83
|
* Npm packages can be installed with different names than the one declared in
|
|
@@ -501,8 +501,7 @@ function resolveSolidityConfig(
|
|
|
501
501
|
|
|
502
502
|
function resolveBuildProfileConfig(
|
|
503
503
|
solidityConfig:
|
|
504
|
-
|
|
|
505
|
-
| MultiVersionSolidityUserConfig,
|
|
504
|
+
SingleVersionSolidityUserConfig | MultiVersionSolidityUserConfig,
|
|
506
505
|
production: boolean = false,
|
|
507
506
|
toolVersionsInBuildInfo?: boolean,
|
|
508
507
|
): SolidityBuildProfileConfig {
|
|
@@ -606,8 +605,7 @@ export function isSolcSolidityCompilerUserConfig(
|
|
|
606
605
|
|
|
607
606
|
function copyFromDefault(
|
|
608
607
|
defaultSolidityConfig:
|
|
609
|
-
|
|
|
610
|
-
| MultiVersionSolidityUserConfig,
|
|
608
|
+
SingleVersionSolidityUserConfig | MultiVersionSolidityUserConfig,
|
|
611
609
|
): SingleVersionSolidityUserConfig | MultiVersionSolidityUserConfig {
|
|
612
610
|
if ("version" in defaultSolidityConfig) {
|
|
613
611
|
return {
|
|
@@ -27,8 +27,7 @@ import type {
|
|
|
27
27
|
} from "../build-system/build-system.js";
|
|
28
28
|
|
|
29
29
|
let SolidityBuildSystemImplementation:
|
|
30
|
-
|
|
31
|
-
| undefined;
|
|
30
|
+
typeof SolidityBuildSystemImplementationT | undefined;
|
|
32
31
|
|
|
33
32
|
class LazySolidityBuildSystem implements SolidityBuildSystem {
|
|
34
33
|
readonly #hooks: HookManager;
|
|
@@ -71,8 +71,7 @@ declare module "../../../types/config.js" {
|
|
|
71
71
|
* NOTE: All the variants of SingleVersionSolidityUserConfig must extend this
|
|
72
72
|
* interface.
|
|
73
73
|
*/
|
|
74
|
-
export interface CommonSingleVersionSolidityUserConfig
|
|
75
|
-
extends CommonSolidityUserConfig {
|
|
74
|
+
export interface CommonSingleVersionSolidityUserConfig extends CommonSolidityUserConfig {
|
|
76
75
|
toolVersionsInBuildInfo?: boolean;
|
|
77
76
|
}
|
|
78
77
|
|
|
@@ -122,7 +121,9 @@ declare module "../../../types/config.js" {
|
|
|
122
121
|
*/
|
|
123
122
|
export type SolidityCompilerUserConfig =
|
|
124
123
|
| {
|
|
125
|
-
[
|
|
124
|
+
[
|
|
125
|
+
type in keyof SolidityCompilerUserConfigPerType
|
|
126
|
+
]: SolidityCompilerUserConfigPerType[type];
|
|
126
127
|
}[keyof SolidityCompilerUserConfigPerType]
|
|
127
128
|
// SolcSolidityCompilerUserConfig when the type isn't present
|
|
128
129
|
| (Omit<SolcSolidityCompilerUserConfig, "type"> &
|
|
@@ -133,7 +134,8 @@ declare module "../../../types/config.js" {
|
|
|
133
134
|
* @deprecated
|
|
134
135
|
*/
|
|
135
136
|
export interface SingleVersionSolcUserConfig
|
|
136
|
-
extends
|
|
137
|
+
extends
|
|
138
|
+
SolcSolidityCompilerUserConfig,
|
|
137
139
|
CommonSingleVersionSolidityUserConfig {}
|
|
138
140
|
|
|
139
141
|
/**
|
|
@@ -141,8 +143,7 @@ declare module "../../../types/config.js" {
|
|
|
141
143
|
*/
|
|
142
144
|
/* eslint-disable-next-line @typescript-eslint/no-empty-interface -- Defined
|
|
143
145
|
in SingleVersionSolcUserConfig for backwards compatibility */
|
|
144
|
-
export interface SolcSingleVersionSolidityUserConfig
|
|
145
|
-
extends SingleVersionSolcUserConfig {}
|
|
146
|
+
export interface SolcSingleVersionSolidityUserConfig extends SingleVersionSolcUserConfig {}
|
|
146
147
|
|
|
147
148
|
/**
|
|
148
149
|
* A map from compiler type to its SingleVersionSolidityUserConfig type.
|
|
@@ -158,7 +159,9 @@ declare module "../../../types/config.js" {
|
|
|
158
159
|
*/
|
|
159
160
|
export type SingleVersionSolidityUserConfig =
|
|
160
161
|
| {
|
|
161
|
-
[
|
|
162
|
+
[
|
|
163
|
+
type in keyof SingleVersionSolidityUserConfigPerType
|
|
164
|
+
]: SingleVersionSolidityUserConfigPerType[type];
|
|
162
165
|
}[keyof SingleVersionSolidityUserConfigPerType]
|
|
163
166
|
// SolcSingleVersionSolidityUserConfig when the type isn't present
|
|
164
167
|
| (Omit<SolcSingleVersionSolidityUserConfig, "type"> &
|
|
@@ -188,8 +191,7 @@ declare module "../../../types/config.js" {
|
|
|
188
191
|
* compatibility.
|
|
189
192
|
*/
|
|
190
193
|
export interface MultiVersionSolidityUserConfig
|
|
191
|
-
extends MultiVersionSolcUserConfig,
|
|
192
|
-
CommonSolidityUserConfig {
|
|
194
|
+
extends MultiVersionSolcUserConfig, CommonSolidityUserConfig {
|
|
193
195
|
toolVersionsInBuildInfo?: boolean;
|
|
194
196
|
}
|
|
195
197
|
|
|
@@ -206,16 +208,14 @@ declare module "../../../types/config.js" {
|
|
|
206
208
|
* The type of a multi-version build profile user config.
|
|
207
209
|
* Mostly defined in `MultiVersionSolcUserConfig` for backwards compatibility
|
|
208
210
|
*/
|
|
209
|
-
export interface MultiVersionBuildProfileUserConfig
|
|
210
|
-
extends MultiVersionSolcUserConfig {
|
|
211
|
+
export interface MultiVersionBuildProfileUserConfig extends MultiVersionSolcUserConfig {
|
|
211
212
|
toolVersionsInBuildInfo?: boolean;
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
/**
|
|
215
216
|
* The type of the build profile version of the SolidityUserConfig.
|
|
216
217
|
*/
|
|
217
|
-
export interface BuildProfilesSolidityUserConfig
|
|
218
|
-
extends CommonSolidityUserConfig {
|
|
218
|
+
export interface BuildProfilesSolidityUserConfig extends CommonSolidityUserConfig {
|
|
219
219
|
profiles: Record<
|
|
220
220
|
string,
|
|
221
221
|
SingleVersionBuildProfileUserConfig | MultiVersionBuildProfileUserConfig
|
|
@@ -274,7 +274,9 @@ declare module "../../../types/config.js" {
|
|
|
274
274
|
*/
|
|
275
275
|
export type SolidityCompilerConfig =
|
|
276
276
|
| {
|
|
277
|
-
[
|
|
277
|
+
[
|
|
278
|
+
type in keyof SolidityCompilerConfigPerType
|
|
279
|
+
]: SolidityCompilerConfigPerType[type] & {
|
|
278
280
|
type: type;
|
|
279
281
|
};
|
|
280
282
|
}[keyof SolidityCompilerConfigPerType]
|
|
@@ -38,6 +38,7 @@ interface SolidityTestConfigParams {
|
|
|
38
38
|
verbosity: number;
|
|
39
39
|
observability?: ObservabilityConfig;
|
|
40
40
|
testPattern?: string;
|
|
41
|
+
excludeTestPattern?: string;
|
|
41
42
|
generateGasReport: boolean;
|
|
42
43
|
testFunctionOverrides?: TestFunctionOverride[];
|
|
43
44
|
eip712CanonicalTypes?: string[];
|
|
@@ -51,6 +52,7 @@ export async function solidityTestConfigToSolidityTestRunnerConfigArgs({
|
|
|
51
52
|
verbosity,
|
|
52
53
|
observability,
|
|
53
54
|
testPattern,
|
|
55
|
+
excludeTestPattern,
|
|
54
56
|
generateGasReport,
|
|
55
57
|
testFunctionOverrides,
|
|
56
58
|
eip712CanonicalTypes,
|
|
@@ -149,7 +151,9 @@ export async function solidityTestConfigToSolidityTestRunnerConfigArgs({
|
|
|
149
151
|
txOrigin,
|
|
150
152
|
blockCoinbase,
|
|
151
153
|
observability,
|
|
152
|
-
testPattern,
|
|
154
|
+
testPattern: testPattern === "" ? undefined : testPattern,
|
|
155
|
+
excludeTestPattern:
|
|
156
|
+
excludeTestPattern === "" ? undefined : excludeTestPattern,
|
|
153
157
|
includeTraces,
|
|
154
158
|
blockGasLimit,
|
|
155
159
|
disableBlockGasLimit,
|
|
@@ -31,6 +31,12 @@ const hardhatPlugin: HardhatPlugin = definePlugin({
|
|
|
31
31
|
type: ArgumentType.STRING_WITHOUT_DEFAULT,
|
|
32
32
|
defaultValue: undefined,
|
|
33
33
|
})
|
|
34
|
+
.addOption({
|
|
35
|
+
name: "grepExclude",
|
|
36
|
+
description: "Skip tests matching the given string or regexp",
|
|
37
|
+
type: ArgumentType.STRING_WITHOUT_DEFAULT,
|
|
38
|
+
defaultValue: undefined,
|
|
39
|
+
})
|
|
34
40
|
.addFlag({
|
|
35
41
|
name: "noCompile",
|
|
36
42
|
description: "Don't compile the project before running the tests",
|
|
@@ -143,7 +143,8 @@ async function collectRawOverrides(
|
|
|
143
143
|
);
|
|
144
144
|
|
|
145
145
|
throw new HardhatError(
|
|
146
|
-
HardhatError.ERRORS.CORE.SOLIDITY_TESTS
|
|
146
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS
|
|
147
|
+
.BUILD_INFO_NOT_FOUND_FOR_CONTRACT,
|
|
147
148
|
{
|
|
148
149
|
fqn,
|
|
149
150
|
},
|
|
@@ -265,7 +266,8 @@ function buildTestFunctionOverrides(
|
|
|
265
266
|
|
|
266
267
|
if (selector === undefined) {
|
|
267
268
|
throw new HardhatError(
|
|
268
|
-
HardhatError.ERRORS.CORE.SOLIDITY_TESTS
|
|
269
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS
|
|
270
|
+
.INLINE_CONFIG_UNRESOLVED_SELECTOR,
|
|
269
271
|
{ functionFqn },
|
|
270
272
|
);
|
|
271
273
|
}
|
|
@@ -161,7 +161,8 @@ export function parseInlineConfigLine(
|
|
|
161
161
|
const profile = firstSegment;
|
|
162
162
|
if (profile !== "default") {
|
|
163
163
|
throw new HardhatError(
|
|
164
|
-
HardhatError.ERRORS.CORE.SOLIDITY_TESTS
|
|
164
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS
|
|
165
|
+
.INLINE_CONFIG_UNSUPPORTED_PROFILE,
|
|
165
166
|
{
|
|
166
167
|
profile,
|
|
167
168
|
functionFqn,
|
|
@@ -66,7 +66,8 @@ export function validateInlineOverrides(overrides: RawInlineOverride[]): void {
|
|
|
66
66
|
.join(", ");
|
|
67
67
|
|
|
68
68
|
throw new HardhatError(
|
|
69
|
-
HardhatError.ERRORS.CORE.SOLIDITY_TESTS
|
|
69
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS
|
|
70
|
+
.INLINE_CONFIG_INVALID_KEY_FOR_TEST_TYPE,
|
|
70
71
|
{
|
|
71
72
|
key: rawKey,
|
|
72
73
|
functionFqn,
|
|
@@ -272,7 +272,7 @@ export async function* testReporter(
|
|
|
272
272
|
reason =
|
|
273
273
|
failure.reason?.startsWith("FFI is disabled") === true
|
|
274
274
|
? "FFI is disabled; set `test.solidity.ffi` to `true` in your Hardhat config to allow tests to call external commands"
|
|
275
|
-
: failure.reason ?? "Unknown error";
|
|
275
|
+
: (failure.reason ?? "Unknown error");
|
|
276
276
|
}
|
|
277
277
|
yield* output(indenter.t`${colorize("red", `Error: ${reason}`)}\n`);
|
|
278
278
|
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- Ignore Cases not matched: undefined
|
|
@@ -102,7 +102,8 @@ export function run(
|
|
|
102
102
|
|
|
103
103
|
stream.destroy(
|
|
104
104
|
new HardhatError(
|
|
105
|
-
HardhatError.ERRORS.CORE.SOLIDITY_TESTS
|
|
105
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS
|
|
106
|
+
.UNHANDLED_EDR_ERROR_SOLIDITY_TESTS,
|
|
106
107
|
{
|
|
107
108
|
error: error.message,
|
|
108
109
|
},
|
|
@@ -50,6 +50,7 @@ interface TestActionArguments {
|
|
|
50
50
|
testFiles: string[];
|
|
51
51
|
chainType: string;
|
|
52
52
|
grep?: string;
|
|
53
|
+
grepExclude?: string;
|
|
53
54
|
noCompile: boolean;
|
|
54
55
|
testSummaryIndex: number;
|
|
55
56
|
}
|
|
@@ -59,7 +60,7 @@ export interface SolidityTestRunResult extends TestRunResult {
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
62
|
-
{ testFiles, chainType, grep, noCompile, testSummaryIndex },
|
|
63
|
+
{ testFiles, chainType, grep, grepExclude, noCompile, testSummaryIndex },
|
|
63
64
|
hre,
|
|
64
65
|
): Promise<Result<SolidityTestRunResult, SolidityTestRunResult>> => {
|
|
65
66
|
// Set an environment variable that plugins can use to detect when a process is running tests
|
|
@@ -163,7 +164,8 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
163
164
|
|
|
164
165
|
if (notCompiledFiles.length > 0) {
|
|
165
166
|
throw new HardhatError(
|
|
166
|
-
HardhatError.ERRORS.CORE.SOLIDITY_TESTS
|
|
167
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS
|
|
168
|
+
.SELECTED_TEST_FILES_NOT_COMPILED,
|
|
167
169
|
{
|
|
168
170
|
files: notCompiledFiles.map((f) => `- ${f}`).join("\n"),
|
|
169
171
|
},
|
|
@@ -251,6 +253,7 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
251
253
|
verbosity,
|
|
252
254
|
observability: observabilityConfig,
|
|
253
255
|
testPattern: grep,
|
|
256
|
+
excludeTestPattern: grepExclude,
|
|
254
257
|
generateGasReport:
|
|
255
258
|
hre.globalOptions.gasStats ||
|
|
256
259
|
hre.globalOptions.gasStatsJson !== undefined,
|
|
@@ -416,7 +419,8 @@ async function validateThatProvidedFilesAreTests(
|
|
|
416
419
|
|
|
417
420
|
if (nonTests.length > 0) {
|
|
418
421
|
throw new HardhatError(
|
|
419
|
-
HardhatError.ERRORS.CORE.SOLIDITY_TESTS
|
|
422
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS
|
|
423
|
+
.SELECTED_FILES_ARE_NOT_SOLIDITY_TESTS,
|
|
420
424
|
{
|
|
421
425
|
files: nonTests.map((f) => `- ${f}`).join("\n"),
|
|
422
426
|
},
|
|
@@ -85,8 +85,7 @@ declare module "../../../types/test.js" {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
export type SolidityTestUserConfig =
|
|
88
|
-
|
|
|
89
|
-
| SolidityTestProfilesUserConfig;
|
|
88
|
+
SolidityTestProfileUserConfig | SolidityTestProfilesUserConfig;
|
|
90
89
|
|
|
91
90
|
export interface HardhatTestUserConfig {
|
|
92
91
|
solidity?: SolidityTestUserConfig;
|
|
@@ -29,6 +29,12 @@ const hardhatPlugin: HardhatPlugin = definePlugin({
|
|
|
29
29
|
type: ArgumentType.STRING_WITHOUT_DEFAULT,
|
|
30
30
|
defaultValue: undefined,
|
|
31
31
|
})
|
|
32
|
+
.addOption({
|
|
33
|
+
name: "grepExclude",
|
|
34
|
+
description: "Skip tests matching the given string or regexp",
|
|
35
|
+
type: ArgumentType.STRING_WITHOUT_DEFAULT,
|
|
36
|
+
defaultValue: undefined,
|
|
37
|
+
})
|
|
32
38
|
.addFlag({
|
|
33
39
|
name: "noCompile",
|
|
34
40
|
description: "Do not compile the project before running the tests",
|