hardhat 3.11.0 → 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 +37 -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 +13 -8
- 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/init.d.ts +3 -8
- package/dist/src/internal/cli/init/init.d.ts.map +1 -1
- package/dist/src/internal/cli/init/init.js +9 -27
- package/dist/src/internal/cli/init/init.js.map +1 -1
- package/dist/src/internal/cli/init/prompt.d.ts +0 -1
- package/dist/src/internal/cli/init/prompt.d.ts.map +1 -1
- package/dist/src/internal/cli/init/prompt.js +0 -24
- package/dist/src/internal/cli/init/prompt.js.map +1 -1
- package/dist/src/internal/cli/init/template.d.ts +1 -1
- package/dist/src/internal/cli/init/template.d.ts.map +1 -1
- package/dist/src/internal/cli/init/template.js +17 -3
- 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 +3 -2
- package/dist/src/internal/cli/main.js.map +1 -1
- package/dist/src/internal/cli/telemetry/analytics/analytics.d.ts +2 -1
- package/dist/src/internal/cli/telemetry/analytics/analytics.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/analytics/analytics.js +11 -2
- package/dist/src/internal/cli/telemetry/analytics/analytics.js.map +1 -1
- package/dist/src/internal/cli/telemetry/analytics/types.d.ts +6 -1
- 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 +14 -14
- 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 +15 -7
- 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/init.ts +4 -38
- package/src/internal/cli/init/prompt.ts +0 -31
- package/src/internal/cli/init/template.ts +18 -5
- package/src/internal/cli/main.ts +6 -5
- package/src/internal/cli/telemetry/analytics/analytics.ts +14 -2
- package/src/internal/cli/telemetry/analytics/types.ts +7 -1
- 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/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/package.json +1 -1
- package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/package.json +1 -1
- package/templates/{hardhat-3/03-minimal → 03-minimal}/package.json +1 -1
- package/templates/hardhat-2/01-mocha-ethers-js/README.md +0 -13
- package/templates/hardhat-2/01-mocha-ethers-js/contracts/Lock.sol +0 -34
- package/templates/hardhat-2/01-mocha-ethers-js/gitignore +0 -17
- package/templates/hardhat-2/01-mocha-ethers-js/hardhat.config.js +0 -6
- package/templates/hardhat-2/01-mocha-ethers-js/ignition/modules/Lock.js +0 -18
- package/templates/hardhat-2/01-mocha-ethers-js/package.json +0 -23
- package/templates/hardhat-2/01-mocha-ethers-js/test/Lock.js +0 -126
- package/templates/hardhat-2/02-mocha-ethers-js-esm/README.md +0 -13
- package/templates/hardhat-2/02-mocha-ethers-js-esm/contracts/Lock.sol +0 -34
- package/templates/hardhat-2/02-mocha-ethers-js-esm/gitignore +0 -17
- package/templates/hardhat-2/02-mocha-ethers-js-esm/hardhat.config.cjs +0 -6
- package/templates/hardhat-2/02-mocha-ethers-js-esm/ignition/modules/Lock.js +0 -18
- package/templates/hardhat-2/02-mocha-ethers-js-esm/package.json +0 -24
- package/templates/hardhat-2/02-mocha-ethers-js-esm/test/Lock.js +0 -128
- package/templates/hardhat-2/03-mocha-ethers-ts/README.md +0 -13
- package/templates/hardhat-2/03-mocha-ethers-ts/contracts/Lock.sol +0 -34
- package/templates/hardhat-2/03-mocha-ethers-ts/gitignore +0 -17
- package/templates/hardhat-2/03-mocha-ethers-ts/hardhat.config.ts +0 -8
- package/templates/hardhat-2/03-mocha-ethers-ts/ignition/modules/Lock.ts +0 -20
- package/templates/hardhat-2/03-mocha-ethers-ts/package.json +0 -28
- package/templates/hardhat-2/03-mocha-ethers-ts/test/Lock.ts +0 -127
- package/templates/hardhat-2/03-mocha-ethers-ts/tsconfig.json +0 -11
- package/templates/hardhat-2/04-mocha-viem-ts/README.md +0 -13
- package/templates/hardhat-2/04-mocha-viem-ts/contracts/Lock.sol +0 -34
- package/templates/hardhat-2/04-mocha-viem-ts/gitignore +0 -17
- package/templates/hardhat-2/04-mocha-viem-ts/hardhat.config.ts +0 -8
- package/templates/hardhat-2/04-mocha-viem-ts/ignition/modules/Lock.ts +0 -21
- package/templates/hardhat-2/04-mocha-viem-ts/package.json +0 -25
- package/templates/hardhat-2/04-mocha-viem-ts/test/Lock.ts +0 -134
- package/templates/hardhat-2/04-mocha-viem-ts/tsconfig.json +0 -11
- package/templates/hardhat-2/05-empty-hardhat-config-js/hardhat.config.js +0 -4
- package/templates/hardhat-2/05-empty-hardhat-config-js/package.json +0 -9
- /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/AGENTS.md +0 -0
- /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/README.md +0 -0
- /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/contracts/Counter.sol +0 -0
- /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/contracts/Counter.t.sol +0 -0
- /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/gitignore +0 -0
- /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/hardhat.config.ts +0 -0
- /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/ignition/modules/Counter.ts +0 -0
- /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/scripts/send-op-tx.ts +0 -0
- /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/test/Counter.ts +0 -0
- /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/tsconfig.json +0 -0
- /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/AGENTS.md +0 -0
- /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/README.md +0 -0
- /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/contracts/Counter.sol +0 -0
- /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/contracts/Counter.t.sol +0 -0
- /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/gitignore +0 -0
- /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/hardhat.config.ts +0 -0
- /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/ignition/modules/Counter.ts +0 -0
- /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/scripts/send-op-tx.ts +0 -0
- /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/test/Counter.ts +0 -0
- /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/tsconfig.json +0 -0
- /package/templates/{hardhat-3/03-minimal → 03-minimal}/README.md +0 -0
- /package/templates/{hardhat-3/03-minimal → 03-minimal}/gitignore +0 -0
- /package/templates/{hardhat-3/03-minimal → 03-minimal}/hardhat.config.ts +0 -0
- /package/templates/{hardhat-3/03-minimal → 03-minimal}/tsconfig.json +0 -0
|
@@ -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>
|
|
@@ -153,19 +153,26 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
public async getScope(fsPath: string): Promise<BuildScope> {
|
|
156
|
+
const isUnderSources = this.#options.soliditySourcesPaths.some(
|
|
157
|
+
(sourcesPath) => fsPath.startsWith(sourcesPath + path.sep),
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
// A `.sol` file under the tests path is a test, unless it is
|
|
161
|
+
// also registered as under a Solidity sources path. Sources takes
|
|
162
|
+
// precedence (e.g. `test/` is listed in `paths.sources.solidity` to access
|
|
163
|
+
// `./test/mocks`)
|
|
156
164
|
if (
|
|
165
|
+
!isUnderSources &&
|
|
157
166
|
fsPath.startsWith(this.#options.solidityTestsPath + path.sep) &&
|
|
158
167
|
fsPath.endsWith(".sol")
|
|
159
168
|
) {
|
|
160
169
|
return "tests";
|
|
161
170
|
}
|
|
162
171
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
}
|
|
172
|
+
// Foundry-style `.t.sol` files under a sources path are always tests, even
|
|
173
|
+
// when sources take precedence over the tests path.
|
|
174
|
+
if (fsPath.endsWith(".t.sol") && isUnderSources) {
|
|
175
|
+
return "tests";
|
|
169
176
|
}
|
|
170
177
|
|
|
171
178
|
return "contracts";
|
|
@@ -1357,7 +1364,8 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
1357
1364
|
[partialCompilerConfig],
|
|
1358
1365
|
async () => {
|
|
1359
1366
|
throw new HardhatError(
|
|
1360
|
-
HardhatError.ERRORS.CORE.SOLIDITY
|
|
1367
|
+
HardhatError.ERRORS.CORE.SOLIDITY
|
|
1368
|
+
.BUILD_INFO_COMPILER_TYPE_NOT_HANDLED,
|
|
1361
1369
|
{
|
|
1362
1370
|
compilerType,
|
|
1363
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",
|
|
@@ -24,6 +24,7 @@ interface TestActionArguments {
|
|
|
24
24
|
testFiles: string[];
|
|
25
25
|
chainType: string;
|
|
26
26
|
grep: string | undefined;
|
|
27
|
+
grepExclude: string | undefined;
|
|
27
28
|
noCompile: boolean;
|
|
28
29
|
}
|
|
29
30
|
|
|
@@ -51,7 +52,7 @@ function isTestRunResult(
|
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
const runAllTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
54
|
-
{ testFiles, chainType, grep, noCompile, ...otherArgs },
|
|
55
|
+
{ testFiles, chainType, grep, grepExclude, noCompile, ...otherArgs },
|
|
55
56
|
hre,
|
|
56
57
|
): Promise<Result<void, void>> => {
|
|
57
58
|
// If this code is executed, it means the user has not specified a test runner.
|
|
@@ -98,10 +99,17 @@ const runAllTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
98
99
|
|
|
99
100
|
const args: TaskArguments = {
|
|
100
101
|
testFiles: files,
|
|
101
|
-
grep,
|
|
102
102
|
noCompile: subtask.options.has("noCompile"),
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
+
if (subtask.options.has("grep")) {
|
|
106
|
+
args.grep = grep;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (subtask.options.has("grepExclude")) {
|
|
110
|
+
args.grepExclude = grepExclude;
|
|
111
|
+
}
|
|
112
|
+
|
|
105
113
|
if (subtask.options.has("chainType")) {
|
|
106
114
|
args.chainType = chainType;
|
|
107
115
|
}
|
|
@@ -166,9 +166,8 @@ async function getErrorWithCategory(error: Error): Promise<ErrorWithCategory> {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
if (classifierModule === undefined) {
|
|
169
|
-
classifierModule =
|
|
170
|
-
"./telemetry/error-classification/classifier.js"
|
|
171
|
-
);
|
|
169
|
+
classifierModule =
|
|
170
|
+
await import("./telemetry/error-classification/classifier.js");
|
|
172
171
|
}
|
|
173
172
|
|
|
174
173
|
// Pass `ignoreDevelopmentTimeFilter=true` so the migration footer also shows
|
|
@@ -50,7 +50,6 @@ import {
|
|
|
50
50
|
promptForTemplate,
|
|
51
51
|
promptForUpdate,
|
|
52
52
|
promptForWorkspace,
|
|
53
|
-
promptForHardhatVersion,
|
|
54
53
|
} from "./prompt.js";
|
|
55
54
|
import { spawn } from "./subprocess.js";
|
|
56
55
|
import { getTemplates } from "./template.js";
|
|
@@ -60,7 +59,6 @@ export interface NonInteractiveInitHardhat3Options {
|
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
export interface InitHardhatOptions {
|
|
63
|
-
hardhatVersion?: "hardhat-2" | "hardhat-3";
|
|
64
62
|
workspace?: string;
|
|
65
63
|
migrateToEsm?: boolean;
|
|
66
64
|
template?: string;
|
|
@@ -74,7 +72,6 @@ export async function initHardhat3NonInteractive(
|
|
|
74
72
|
options: NonInteractiveInitHardhat3Options,
|
|
75
73
|
): Promise<void> {
|
|
76
74
|
const [template, projectTypeAnalyticsPromise] = await getTemplate(
|
|
77
|
-
"hardhat-3",
|
|
78
75
|
options.template,
|
|
79
76
|
true,
|
|
80
77
|
);
|
|
@@ -161,9 +158,6 @@ export async function initHardhat(options?: InitHardhatOptions): Promise<void> {
|
|
|
161
158
|
|
|
162
159
|
await printWelcomeMessage();
|
|
163
160
|
|
|
164
|
-
const hardhatVersion =
|
|
165
|
-
options?.hardhatVersion ?? (await promptForHardhatVersion());
|
|
166
|
-
|
|
167
161
|
// Ask the user for the workspace to initialize the project in
|
|
168
162
|
// if it was not provided, and validate that it is not already initialized
|
|
169
163
|
const workspace = await getWorkspace(options?.workspace);
|
|
@@ -171,7 +165,6 @@ export async function initHardhat(options?: InitHardhatOptions): Promise<void> {
|
|
|
171
165
|
// Ask the user for the template to use for the project initialization
|
|
172
166
|
// if it was not provided, and validate that it exists
|
|
173
167
|
const [template, projectTypeAnalyticsPromise] = await getTemplate(
|
|
174
|
-
hardhatVersion,
|
|
175
168
|
options?.template,
|
|
176
169
|
);
|
|
177
170
|
|
|
@@ -339,7 +332,6 @@ export async function getWorkspace(workspace?: string): Promise<string> {
|
|
|
339
332
|
*
|
|
340
333
|
* NOTE: This function is exported for testing purposes
|
|
341
334
|
*
|
|
342
|
-
* @param hardhatVersion The version of Hardhat whose templates should be considered.
|
|
343
335
|
* @param template The name of the template to use for the project initialization.
|
|
344
336
|
* @param includeAvailableTemplatesInErrors When true, a missing template throws
|
|
345
337
|
* `TEMPLATE_NOT_FOUND_WITH_LIST_OF_OPTIONS` (which lists the available
|
|
@@ -347,21 +339,17 @@ export async function getWorkspace(workspace?: string): Promise<string> {
|
|
|
347
339
|
* @returns A tuple with two elements: the template and a promise with the analytics hit.
|
|
348
340
|
*/
|
|
349
341
|
export async function getTemplate(
|
|
350
|
-
hardhatVersion: "hardhat-2" | "hardhat-3",
|
|
351
342
|
template?: string,
|
|
352
343
|
includeAvailableTemplatesInErrors = false,
|
|
353
344
|
): Promise<[Template, Promise<boolean>]> {
|
|
354
|
-
const templates = await getTemplates(
|
|
345
|
+
const templates = await getTemplates();
|
|
355
346
|
|
|
356
347
|
// Ask the user for the template to use for the project initialization if it was not provided
|
|
357
348
|
if (template === undefined) {
|
|
358
349
|
template = await promptForTemplate(templates);
|
|
359
350
|
}
|
|
360
351
|
|
|
361
|
-
const projectTypeAnalyticsPromise = sendProjectTypeAnalytics(
|
|
362
|
-
hardhatVersion,
|
|
363
|
-
template,
|
|
364
|
-
);
|
|
352
|
+
const projectTypeAnalyticsPromise = sendProjectTypeAnalytics(template);
|
|
365
353
|
|
|
366
354
|
// Validate that the template exists
|
|
367
355
|
for (const t of templates) {
|
|
@@ -393,16 +381,12 @@ export async function getTemplate(
|
|
|
393
381
|
}
|
|
394
382
|
|
|
395
383
|
/**
|
|
396
|
-
* Prints the list of available templates
|
|
397
|
-
*
|
|
398
|
-
* @param hardhatVersion The version of Hardhat whose templates should be
|
|
399
|
-
* printed.
|
|
384
|
+
* Prints the list of available templates.
|
|
400
385
|
*/
|
|
401
386
|
export async function printTemplatesList(
|
|
402
|
-
hardhatVersion: "hardhat-2" | "hardhat-3",
|
|
403
387
|
print: (message: string) => void = console.log,
|
|
404
388
|
): Promise<void> {
|
|
405
|
-
const templates = await getTemplates(
|
|
389
|
+
const templates = await getTemplates();
|
|
406
390
|
const lines = templates.map((t) => ` - ${t.name}`).join("\n");
|
|
407
391
|
print(`Available templates:\n${lines}`);
|
|
408
392
|
}
|
|
@@ -448,24 +432,6 @@ export async function validatePackageJson(
|
|
|
448
432
|
// package managers support `<package manager> pkg set type=module`.
|
|
449
433
|
const packageManagerToUse = packageManager === "pnpm" ? "pnpm" : "npm";
|
|
450
434
|
|
|
451
|
-
// We need to set the hardhat version in the package.json file
|
|
452
|
-
// to ensure that the template is compatible with the current Hardhat version.
|
|
453
|
-
// This is needed because we have hardhat-2 and hardhat-3 templates,
|
|
454
|
-
// and the user may install hardhat 3 first and then initialize a project
|
|
455
|
-
// with a hardhat-2 template.
|
|
456
|
-
const templateHardhatVersion = templatePkg.devDependencies?.hardhat ?? "";
|
|
457
|
-
if (templateHardhatVersion.startsWith("^2")) {
|
|
458
|
-
await spawn(
|
|
459
|
-
[packageManagerToUse, "pkg", "delete", "dependencies.hardhat"].join(" "),
|
|
460
|
-
[],
|
|
461
|
-
{
|
|
462
|
-
cwd: workspace,
|
|
463
|
-
shell: true,
|
|
464
|
-
stdio: "inherit",
|
|
465
|
-
},
|
|
466
|
-
);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
435
|
if (!shouldUseEsm) {
|
|
470
436
|
return;
|
|
471
437
|
}
|