hardhat 3.1.12 → 3.3.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 +57 -0
- package/dist/src/internal/builtin-global-options.d.ts.map +1 -1
- package/dist/src/internal/builtin-global-options.js +14 -1
- package/dist/src/internal/builtin-global-options.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts +5 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.js +12 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers.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 -5
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +3 -5
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js +4 -15
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts +11 -10
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +80 -13
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts +5 -5
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js +25 -3
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.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 +4 -5
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js +13 -17
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js +8 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/types.d.ts +33 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/types.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.js +12 -2
- 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-provider.d.ts +9 -3
- 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 +65 -42
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/genesis-state.d.ts +11 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/genesis-state.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/genesis-state.js +104 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/genesis-state.js.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts +6 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js +152 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.d.ts +19 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js +104 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/hre.js +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/hook-handlers/network.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/network.js +8 -8
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/network.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.js +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.d.ts +2 -2
- 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 +78 -8
- 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 +56 -33
- 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/request-handlers/handlers-array.d.ts +0 -3
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers-array.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers-array.js +9 -12
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers-array.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js +1 -1
- package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/node/helpers.js +6 -2
- package/dist/src/internal/builtin-plugins/node/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/json-rpc/handler.js +7 -2
- package/dist/src/internal/builtin-plugins/node/json-rpc/handler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/artifacts.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/artifacts.js +4 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/artifacts.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts +5 -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 +86 -47
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/cache.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/cache.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/cache.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.d.ts +3 -3
- 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 +24 -4
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.d.ts +16 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +1 -2
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.d.ts +10 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js +29 -6
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.d.ts +2 -2
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts +6 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js +11 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/config.d.ts +4 -2
- package/dist/src/internal/builtin-plugins/solidity/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/config.js +249 -64
- package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/exports.d.ts +3 -0
- package/dist/src/internal/builtin-plugins/solidity/exports.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/exports.js +3 -0
- package/dist/src/internal/builtin-plugins/solidity/exports.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/config.js +2 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/solidity.d.ts +4 -0
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/solidity.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/solidity.js +7 -0
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/solidity.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/index.js +1 -0
- package/dist/src/internal/builtin-plugins/solidity/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/solidity-hooks.d.ts +18 -0
- package/dist/src/internal/builtin-plugins/solidity/solidity-hooks.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/solidity-hooks.js +33 -0
- package/dist/src/internal/builtin-plugins/solidity/solidity-hooks.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts +201 -28
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.d.ts +12 -6
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js +9 -7
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/formatters.d.ts +1 -12
- package/dist/src/internal/builtin-plugins/solidity-test/formatters.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/formatters.js +0 -150
- package/dist/src/internal/builtin-plugins/solidity-test/formatters.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +4 -3
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +5 -9
- 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 +0 -7
- package/dist/src/internal/builtin-plugins/solidity-test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.d.ts +7 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.js +20 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/helpers.d.ts +24 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/helpers.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/helpers.js +68 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/helpers.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/index.d.ts +13 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/index.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/index.js +136 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/index.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/parsing.d.ts +19 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/parsing.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/parsing.js +133 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/parsing.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/types.d.ts +10 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/types.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/types.js +2 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/types.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.d.ts +12 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.js +81 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +5 -2
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts +0 -1
- 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 +30 -20
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.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 +0 -7
- package/dist/src/internal/builtin-plugins/test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.d.ts +0 -1
- package/dist/src/internal/builtin-plugins/test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js +27 -13
- package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
- package/dist/src/internal/cli/help/get-help-string.d.ts.map +1 -1
- package/dist/src/internal/cli/help/get-help-string.js +1 -1
- package/dist/src/internal/cli/help/get-help-string.js.map +1 -1
- package/dist/src/internal/cli/init/init.d.ts.map +1 -1
- package/dist/src/internal/cli/init/init.js +1 -1
- package/dist/src/internal/cli/init/init.js.map +1 -1
- package/dist/src/internal/cli/init/prompt.d.ts.map +1 -1
- package/dist/src/internal/cli/init/prompt.js +1 -7
- package/dist/src/internal/cli/init/prompt.js.map +1 -1
- package/dist/src/internal/core/hre.d.ts +2 -1
- package/dist/src/internal/core/hre.d.ts.map +1 -1
- package/dist/src/internal/core/hre.js +18 -0
- package/dist/src/internal/core/hre.js.map +1 -1
- package/dist/src/internal/core/plugins/detect-plugin-npm-dependency-problems.d.ts.map +1 -1
- package/dist/src/internal/core/plugins/detect-plugin-npm-dependency-problems.js +6 -1
- package/dist/src/internal/core/plugins/detect-plugin-npm-dependency-problems.js.map +1 -1
- package/dist/src/internal/core/user-interruptions.d.ts.map +1 -1
- package/dist/src/internal/core/user-interruptions.js +2 -5
- package/dist/src/internal/core/user-interruptions.js.map +1 -1
- package/dist/src/internal/utils/colorizer.d.ts +10 -0
- package/dist/src/internal/utils/colorizer.d.ts.map +1 -0
- package/dist/src/internal/utils/colorizer.js +2 -0
- package/dist/src/internal/utils/colorizer.js.map +1 -0
- package/dist/src/internal/utils/package.d.ts.map +1 -1
- package/dist/src/internal/utils/package.js +1 -1
- package/dist/src/internal/utils/package.js.map +1 -1
- package/dist/src/types/global-options.d.ts +1 -0
- package/dist/src/types/global-options.d.ts.map +1 -1
- package/dist/src/types/hooks.d.ts +32 -0
- package/dist/src/types/hooks.d.ts.map +1 -1
- package/dist/src/types/network.d.ts +1 -1
- package/dist/src/types/network.d.ts.map +1 -1
- package/dist/src/types/solidity/compilation-job.d.ts +5 -5
- package/dist/src/types/solidity/compilation-job.d.ts.map +1 -1
- package/dist/src/types/solidity/solidity-artifacts.d.ts +15 -0
- package/dist/src/types/solidity/solidity-artifacts.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/internal/builtin-global-options.ts +15 -1
- package/src/internal/builtin-plugins/coverage/helpers.ts +31 -0
- package/src/internal/builtin-plugins/coverage/hook-handlers/hre.ts +2 -10
- package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +3 -12
- package/src/internal/builtin-plugins/coverage/hook-handlers/test.ts +4 -25
- package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +118 -18
- package/src/internal/builtin-plugins/gas-analytics/helpers.ts +44 -3
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts +6 -10
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.ts +18 -26
- package/src/internal/builtin-plugins/gas-analytics/index.ts +9 -1
- package/src/internal/builtin-plugins/gas-analytics/type-extensions.ts +1 -0
- package/src/internal/builtin-plugins/gas-analytics/types.ts +37 -0
- package/src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.ts +25 -3
- package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +107 -56
- package/src/internal/builtin-plugins/network-manager/edr/genesis-state.ts +179 -0
- package/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.ts +197 -0
- package/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.ts +137 -0
- package/src/internal/builtin-plugins/network-manager/hook-handlers/hre.ts +1 -0
- package/src/internal/builtin-plugins/network-manager/hook-handlers/network.ts +8 -11
- package/src/internal/builtin-plugins/network-manager/http-provider.ts +1 -0
- package/src/internal/builtin-plugins/network-manager/network-manager.ts +112 -12
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.ts +98 -34
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers-array.ts +10 -30
- package/src/internal/builtin-plugins/node/artifacts/build-info-watcher.ts +1 -2
- package/src/internal/builtin-plugins/node/helpers.ts +9 -2
- package/src/internal/builtin-plugins/node/json-rpc/handler.ts +8 -2
- package/src/internal/builtin-plugins/solidity/build-system/artifacts.ts +7 -2
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +141 -65
- package/src/internal/builtin-plugins/solidity/build-system/cache.ts +1 -0
- package/src/internal/builtin-plugins/solidity/build-system/compilation-job.ts +34 -7
- package/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +1 -7
- package/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +44 -9
- package/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.ts +4 -2
- package/src/internal/builtin-plugins/solidity/build-system/solc-info.ts +15 -0
- package/src/internal/builtin-plugins/solidity/config.ts +337 -105
- package/src/internal/builtin-plugins/solidity/exports.ts +2 -0
- package/src/internal/builtin-plugins/solidity/hook-handlers/config.ts +3 -0
- package/src/internal/builtin-plugins/solidity/hook-handlers/solidity.ts +9 -0
- package/src/internal/builtin-plugins/solidity/index.ts +1 -0
- package/src/internal/builtin-plugins/solidity/solidity-hooks.ts +53 -0
- package/src/internal/builtin-plugins/solidity/type-extensions.ts +258 -31
- package/src/internal/builtin-plugins/solidity-test/edr-artifacts.ts +22 -10
- package/src/internal/builtin-plugins/solidity-test/formatters.ts +1 -213
- package/src/internal/builtin-plugins/solidity-test/helpers.ts +8 -8
- package/src/internal/builtin-plugins/solidity-test/index.ts +0 -7
- package/src/internal/builtin-plugins/solidity-test/inline-config/constants.ts +21 -0
- package/src/internal/builtin-plugins/solidity-test/inline-config/helpers.ts +99 -0
- package/src/internal/builtin-plugins/solidity-test/inline-config/index.ts +272 -0
- package/src/internal/builtin-plugins/solidity-test/inline-config/parsing.ts +186 -0
- package/src/internal/builtin-plugins/solidity-test/inline-config/types.ts +9 -0
- package/src/internal/builtin-plugins/solidity-test/inline-config/validation.ts +122 -0
- package/src/internal/builtin-plugins/solidity-test/reporter.ts +6 -6
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +52 -38
- package/src/internal/builtin-plugins/test/index.ts +0 -7
- package/src/internal/builtin-plugins/test/task-action.ts +39 -24
- package/src/internal/cli/help/get-help-string.ts +2 -2
- package/src/internal/cli/init/init.ts +1 -1
- package/src/internal/cli/init/prompt.ts +1 -14
- package/src/internal/core/hre.ts +33 -0
- package/src/internal/core/plugins/detect-plugin-npm-dependency-problems.ts +8 -1
- package/src/internal/core/user-interruptions.ts +3 -5
- package/src/internal/utils/colorizer.ts +9 -0
- package/src/internal/utils/package.ts +1 -2
- package/src/types/global-options.ts +1 -0
- package/src/types/hooks.ts +37 -0
- package/src/types/network.ts +2 -2
- package/src/types/solidity/compilation-job.ts +5 -5
- package/src/types/solidity/solidity-artifacts.ts +16 -0
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +6 -6
- package/templates/hardhat-3/02-mocha-ethers/package.json +11 -11
- package/templates/hardhat-3/03-minimal/package.json +1 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { RawInlineOverride } from "./types.js";
|
|
2
|
+
|
|
3
|
+
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
4
|
+
|
|
5
|
+
import { KEY_TYPES } from "./constants.js";
|
|
6
|
+
import { getFunctionFqn } from "./helpers.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Validates a list of raw inline overrides, checking for:
|
|
10
|
+
* - Valid keys
|
|
11
|
+
* - No duplicate keys for the same function
|
|
12
|
+
* - Values of the expected type (numbers must be non-negative integers, booleans
|
|
13
|
+
* must be "true" or "false")
|
|
14
|
+
*
|
|
15
|
+
* Throws a HardhatError if any validation fails.
|
|
16
|
+
*/
|
|
17
|
+
export function validateInlineOverrides(overrides: RawInlineOverride[]): void {
|
|
18
|
+
const seen = new Set<string>();
|
|
19
|
+
|
|
20
|
+
for (const {
|
|
21
|
+
inputSourceName,
|
|
22
|
+
contractName,
|
|
23
|
+
functionName,
|
|
24
|
+
functionSelector,
|
|
25
|
+
rawKey,
|
|
26
|
+
rawValue,
|
|
27
|
+
key,
|
|
28
|
+
} of overrides) {
|
|
29
|
+
const functionFqn = getFunctionFqn(
|
|
30
|
+
inputSourceName,
|
|
31
|
+
contractName,
|
|
32
|
+
functionName,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// Validate key
|
|
36
|
+
if (!Object.hasOwn(KEY_TYPES, key)) {
|
|
37
|
+
throw new HardhatError(
|
|
38
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS.INLINE_CONFIG_INVALID_KEY,
|
|
39
|
+
{
|
|
40
|
+
key: rawKey,
|
|
41
|
+
validKeys: Object.keys(KEY_TYPES).join(", "),
|
|
42
|
+
functionFqn,
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Validate key matches test type
|
|
48
|
+
const dotIndex = key.indexOf(".");
|
|
49
|
+
if (dotIndex !== -1) {
|
|
50
|
+
const keyCategory = key.slice(0, dotIndex);
|
|
51
|
+
const isFuzzTest = functionName.startsWith("test");
|
|
52
|
+
const isInvariantTest = functionName.startsWith("invariant");
|
|
53
|
+
|
|
54
|
+
if (
|
|
55
|
+
(isFuzzTest && keyCategory === "invariant") ||
|
|
56
|
+
(isInvariantTest && keyCategory === "fuzz")
|
|
57
|
+
) {
|
|
58
|
+
const testType = isFuzzTest ? "fuzz" : "invariant";
|
|
59
|
+
const validPrefix = isFuzzTest ? "fuzz." : "invariant.";
|
|
60
|
+
const validKeys = Object.keys(KEY_TYPES)
|
|
61
|
+
.filter((k) => k.startsWith(validPrefix) || !k.includes("."))
|
|
62
|
+
.join(", ");
|
|
63
|
+
|
|
64
|
+
throw new HardhatError(
|
|
65
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS.INLINE_CONFIG_INVALID_KEY_FOR_TEST_TYPE,
|
|
66
|
+
{
|
|
67
|
+
key: rawKey,
|
|
68
|
+
functionFqn,
|
|
69
|
+
testType,
|
|
70
|
+
validKeys,
|
|
71
|
+
},
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Check for duplicates (include selector to allow same key on overloaded functions)
|
|
77
|
+
const functionId =
|
|
78
|
+
functionSelector !== undefined
|
|
79
|
+
? `${functionFqn}#${functionSelector}`
|
|
80
|
+
: functionFqn;
|
|
81
|
+
const dedupeKey = `${functionId}-${key}`;
|
|
82
|
+
if (seen.has(dedupeKey)) {
|
|
83
|
+
throw new HardhatError(
|
|
84
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS.INLINE_CONFIG_DUPLICATE_KEY,
|
|
85
|
+
{ key: rawKey, functionFqn },
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
seen.add(dedupeKey);
|
|
89
|
+
|
|
90
|
+
// Validate value type
|
|
91
|
+
const expectedType = KEY_TYPES[key];
|
|
92
|
+
if (expectedType === "number") {
|
|
93
|
+
if (
|
|
94
|
+
!/^(0|[1-9]\d*)$/.test(rawValue) ||
|
|
95
|
+
!Number.isSafeInteger(Number(rawValue))
|
|
96
|
+
) {
|
|
97
|
+
throw new HardhatError(
|
|
98
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS.INLINE_CONFIG_INVALID_VALUE,
|
|
99
|
+
{
|
|
100
|
+
value: rawValue,
|
|
101
|
+
key: rawKey,
|
|
102
|
+
expectedType: "non-negative integer",
|
|
103
|
+
functionFqn,
|
|
104
|
+
},
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
const lowerValue = rawValue.toLowerCase();
|
|
109
|
+
if (lowerValue !== "true" && lowerValue !== "false") {
|
|
110
|
+
throw new HardhatError(
|
|
111
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS.INLINE_CONFIG_INVALID_VALUE,
|
|
112
|
+
{
|
|
113
|
+
value: rawValue,
|
|
114
|
+
key: rawKey,
|
|
115
|
+
expectedType: "boolean",
|
|
116
|
+
functionFqn,
|
|
117
|
+
},
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
TestReporterResult,
|
|
4
4
|
TestStatus,
|
|
5
5
|
} from "./types.js";
|
|
6
|
+
import type { Colorizer } from "../../utils/colorizer.js";
|
|
6
7
|
import type { TestResult } from "@nomicfoundation/edr";
|
|
7
8
|
|
|
8
9
|
import { bytesToHexString } from "@nomicfoundation/hardhat-utils/hex";
|
|
@@ -11,12 +12,9 @@ import chalk from "chalk";
|
|
|
11
12
|
import { sendErrorTelemetry } from "../../cli/telemetry/sentry/reporter.js";
|
|
12
13
|
import { SolidityTestStackTraceGenerationError } from "../network-manager/edr/stack-traces/stack-trace-generation-errors.js";
|
|
13
14
|
import { encodeStackTraceEntry } from "../network-manager/edr/stack-traces/stack-trace-solidity-errors.js";
|
|
15
|
+
import { formatTraces } from "../network-manager/edr/utils/trace-formatters.js";
|
|
14
16
|
|
|
15
|
-
import {
|
|
16
|
-
type Colorizer,
|
|
17
|
-
formatArtifactId,
|
|
18
|
-
formatTraces,
|
|
19
|
-
} from "./formatters.js";
|
|
17
|
+
import { formatArtifactId } from "./formatters.js";
|
|
20
18
|
import { getMessageFromLastStackTraceEntry } from "./stack-trace-solidity-errors.js";
|
|
21
19
|
|
|
22
20
|
class Indenter {
|
|
@@ -147,6 +145,8 @@ export async function* testReporter(
|
|
|
147
145
|
suiteSuccessCount++;
|
|
148
146
|
if (verbosity >= 5) {
|
|
149
147
|
printSetUpTraces = true;
|
|
148
|
+
}
|
|
149
|
+
if (verbosity >= 4) {
|
|
150
150
|
printExecutionTraces = true;
|
|
151
151
|
}
|
|
152
152
|
break;
|
|
@@ -184,7 +184,7 @@ export async function* testReporter(
|
|
|
184
184
|
if (printSetUpTraces && functionName === "setUp") {
|
|
185
185
|
return true;
|
|
186
186
|
}
|
|
187
|
-
if (printExecutionTraces && functionName !== "setUp
|
|
187
|
+
if (printExecutionTraces && functionName !== "setUp") {
|
|
188
188
|
return true;
|
|
189
189
|
}
|
|
190
190
|
return false;
|
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
BuildInfoAndOutput,
|
|
3
|
+
EdrArtifactWithMetadata,
|
|
4
|
+
} from "./edr-artifacts.js";
|
|
2
5
|
import type { TestEvent } from "./types.js";
|
|
3
6
|
import type { NewTaskActionFunction } from "../../../types/tasks.js";
|
|
4
7
|
import type { TestRunResult } from "../../../types/test.js";
|
|
5
8
|
import type { Result } from "../../../types/utils.js";
|
|
6
9
|
import type {
|
|
7
|
-
Artifact as EdrArtifact,
|
|
8
|
-
BuildInfoAndOutput,
|
|
9
10
|
ObservabilityConfig,
|
|
10
|
-
SolidityTestRunnerConfigArgs,
|
|
11
11
|
TracingConfigWithBuffers,
|
|
12
12
|
SuiteResult,
|
|
13
13
|
} from "@nomicfoundation/edr";
|
|
14
14
|
|
|
15
15
|
import { finished } from "node:stream/promises";
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
assertHardhatInvariant,
|
|
19
|
-
HardhatError,
|
|
20
|
-
} from "@nomicfoundation/hardhat-errors";
|
|
17
|
+
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
21
18
|
import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path";
|
|
22
19
|
import { createNonClosingWriter } from "@nomicfoundation/hardhat-utils/stream";
|
|
23
20
|
|
|
24
21
|
import { getFullyQualifiedName } from "../../../utils/contract-names.js";
|
|
25
22
|
import { errorResult, successfulResult } from "../../../utils/result.js";
|
|
26
|
-
import { HardhatRuntimeEnvironmentImplementation } from "../../core/hre.js";
|
|
27
23
|
import { isSupportedChainType } from "../../edr/chain-type.js";
|
|
28
24
|
import { ArtifactManagerImplementation } from "../artifacts/artifact-manager.js";
|
|
25
|
+
import { getCoverageManager } from "../coverage/helpers.js";
|
|
26
|
+
import { getGasAnalyticsManager } from "../gas-analytics/helpers.js";
|
|
29
27
|
import { edrGasReportToHardhatGasMeasurements } from "../network-manager/edr/utils/convert-to-edr.js";
|
|
30
28
|
|
|
31
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
buildEdrArtifactsWithMetadata,
|
|
31
|
+
getBuildInfosAndOutputs,
|
|
32
|
+
} from "./edr-artifacts.js";
|
|
32
33
|
import {
|
|
33
34
|
isTestSuiteArtifact,
|
|
34
35
|
warnDeprecatedTestFail,
|
|
35
36
|
solidityTestConfigToRunOptions,
|
|
36
37
|
solidityTestConfigToSolidityTestRunnerConfigArgs,
|
|
37
38
|
} from "./helpers.js";
|
|
39
|
+
import { getTestFunctionOverrides } from "./inline-config/index.js";
|
|
38
40
|
import { testReporter } from "./reporter.js";
|
|
39
41
|
import { run } from "./runner.js";
|
|
40
42
|
|
|
@@ -43,7 +45,6 @@ interface TestActionArguments {
|
|
|
43
45
|
chainType: string;
|
|
44
46
|
grep?: string;
|
|
45
47
|
noCompile: boolean;
|
|
46
|
-
verbosity: number;
|
|
47
48
|
testSummaryIndex: number;
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -52,17 +53,14 @@ export interface SolidityTestRunResult extends TestRunResult {
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
55
|
-
{ testFiles, chainType, grep, noCompile,
|
|
56
|
+
{ testFiles, chainType, grep, noCompile, testSummaryIndex },
|
|
56
57
|
hre,
|
|
57
58
|
): Promise<Result<SolidityTestRunResult, SolidityTestRunResult>> => {
|
|
58
|
-
assertHardhatInvariant(
|
|
59
|
-
hre instanceof HardhatRuntimeEnvironmentImplementation,
|
|
60
|
-
"Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation",
|
|
61
|
-
);
|
|
62
|
-
|
|
63
59
|
// Set an environment variable that plugins can use to detect when a process is running tests
|
|
64
60
|
process.env.HH_TEST = "true";
|
|
65
61
|
|
|
62
|
+
const verbosity = hre.globalOptions.verbosity;
|
|
63
|
+
|
|
66
64
|
// Sets the NODE_ENV environment variable to "test" so the code can detect that tests are running
|
|
67
65
|
// This is done by other JS/TS test frameworks like vitest
|
|
68
66
|
process.env.NODE_ENV ??= "test";
|
|
@@ -95,26 +93,27 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
95
93
|
console.log();
|
|
96
94
|
|
|
97
95
|
// EDR needs all artifacts (contracts + tests)
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
userSourceName: string;
|
|
101
|
-
}> = [];
|
|
102
|
-
const buildInfos: BuildInfoAndOutput[] = [];
|
|
96
|
+
const edrArtifactsWithMetadata: EdrArtifactWithMetadata[] = [];
|
|
97
|
+
const allBuildInfosAndOutputs: BuildInfoAndOutput[] = [];
|
|
103
98
|
for (const scope of ["contracts", "tests"] as const) {
|
|
104
99
|
const artifactsDir = await hre.solidity.getArtifactsDirectory(scope);
|
|
105
100
|
const artifactManager = new ArtifactManagerImplementation(artifactsDir);
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
edrArtifactsWithMetadata.push(
|
|
102
|
+
...(await buildEdrArtifactsWithMetadata(artifactManager)),
|
|
103
|
+
);
|
|
104
|
+
allBuildInfosAndOutputs.push(
|
|
105
|
+
...(await getBuildInfosAndOutputs(artifactManager)),
|
|
106
|
+
);
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
const sourceNameToUserSourceName = new Map(
|
|
111
|
-
|
|
110
|
+
edrArtifactsWithMetadata.map(({ userSourceName, edrArtifact }) => [
|
|
112
111
|
edrArtifact.id.source,
|
|
113
112
|
userSourceName,
|
|
114
113
|
]),
|
|
115
114
|
);
|
|
116
115
|
|
|
117
|
-
|
|
116
|
+
edrArtifactsWithMetadata.forEach(({ userSourceName, edrArtifact }) => {
|
|
118
117
|
if (
|
|
119
118
|
testRootPaths.includes(
|
|
120
119
|
resolveFromRoot(hre.config.paths.root, userSourceName),
|
|
@@ -125,14 +124,17 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
125
124
|
}
|
|
126
125
|
});
|
|
127
126
|
|
|
128
|
-
const
|
|
127
|
+
const testSuiteArtifacts = edrArtifactsWithMetadata
|
|
129
128
|
.filter(({ userSourceName }) =>
|
|
130
129
|
testRootPaths.includes(
|
|
131
130
|
resolveFromRoot(hre.config.paths.root, userSourceName),
|
|
132
131
|
),
|
|
133
132
|
)
|
|
134
|
-
.filter(({ edrArtifact }) => isTestSuiteArtifact(edrArtifact))
|
|
135
|
-
|
|
133
|
+
.filter(({ edrArtifact }) => isTestSuiteArtifact(edrArtifact));
|
|
134
|
+
|
|
135
|
+
const testSuiteIds = testSuiteArtifacts.map(
|
|
136
|
+
({ edrArtifact }) => edrArtifact.id,
|
|
137
|
+
);
|
|
136
138
|
|
|
137
139
|
console.log("Running Solidity tests");
|
|
138
140
|
console.log();
|
|
@@ -143,6 +145,7 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
143
145
|
const solidityTestConfig = hre.config.test.solidity;
|
|
144
146
|
let observabilityConfig: ObservabilityConfig | undefined;
|
|
145
147
|
if (hre.globalOptions.coverage) {
|
|
148
|
+
const coverage = getCoverageManager(hre);
|
|
146
149
|
observabilityConfig = {
|
|
147
150
|
codeCoverage: {
|
|
148
151
|
onCollectedCoverageCallback: async (coverageData: Uint8Array[]) => {
|
|
@@ -150,7 +153,7 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
150
153
|
Buffer.from(tag).toString("hex"),
|
|
151
154
|
);
|
|
152
155
|
|
|
153
|
-
await
|
|
156
|
+
await coverage.addData(tags);
|
|
154
157
|
},
|
|
155
158
|
},
|
|
156
159
|
};
|
|
@@ -166,7 +169,12 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
171
|
|
|
169
|
-
const
|
|
172
|
+
const testFunctionOverrides = getTestFunctionOverrides(
|
|
173
|
+
testSuiteArtifacts,
|
|
174
|
+
allBuildInfosAndOutputs,
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const testRunnerConfig =
|
|
170
178
|
await solidityTestConfigToSolidityTestRunnerConfigArgs({
|
|
171
179
|
chainType,
|
|
172
180
|
projectRoot: hre.config.paths.root,
|
|
@@ -175,14 +183,19 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
175
183
|
verbosity,
|
|
176
184
|
observability: observabilityConfig,
|
|
177
185
|
testPattern: grep,
|
|
178
|
-
generateGasReport:
|
|
186
|
+
generateGasReport:
|
|
187
|
+
hre.globalOptions.gasStats ||
|
|
188
|
+
hre.globalOptions.gasStatsJson !== undefined,
|
|
189
|
+
testFunctionOverrides,
|
|
179
190
|
});
|
|
180
191
|
const tracingConfig: TracingConfigWithBuffers = {
|
|
181
|
-
buildInfos,
|
|
192
|
+
buildInfos: allBuildInfosAndOutputs.map(({ buildInfo, output }) => ({
|
|
193
|
+
buildInfo,
|
|
194
|
+
output,
|
|
195
|
+
})),
|
|
182
196
|
ignoreContracts: false,
|
|
183
197
|
};
|
|
184
|
-
const
|
|
185
|
-
solidityTestConfigToRunOptions(solidityTestConfig);
|
|
198
|
+
const runOptions = solidityTestConfigToRunOptions(solidityTestConfig);
|
|
186
199
|
|
|
187
200
|
await hre.hooks.runHandlerChain(
|
|
188
201
|
"test",
|
|
@@ -193,12 +206,12 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
193
206
|
|
|
194
207
|
const runStream = run(
|
|
195
208
|
chainType,
|
|
196
|
-
|
|
209
|
+
edrArtifactsWithMetadata.map(({ edrArtifact }) => edrArtifact),
|
|
197
210
|
testSuiteIds,
|
|
198
211
|
testRunnerConfig,
|
|
199
212
|
tracingConfig,
|
|
200
213
|
sourceNameToUserSourceName,
|
|
201
|
-
|
|
214
|
+
runOptions,
|
|
202
215
|
);
|
|
203
216
|
|
|
204
217
|
let failed = 0;
|
|
@@ -232,8 +245,9 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
232
245
|
testContractFqns,
|
|
233
246
|
);
|
|
234
247
|
|
|
248
|
+
const gasAnalytics = getGasAnalyticsManager(hre);
|
|
235
249
|
for (const measurement of gasMeasurements) {
|
|
236
|
-
|
|
250
|
+
gasAnalytics.addGasMeasurement(measurement);
|
|
237
251
|
}
|
|
238
252
|
}
|
|
239
253
|
})
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { HardhatPlugin } from "../../../types/plugins.js";
|
|
2
2
|
|
|
3
3
|
import { ArgumentType } from "../../../types/arguments.js";
|
|
4
|
-
import { DEFAULT_VERBOSITY } from "../../constants.js";
|
|
5
4
|
import { task } from "../../core/config.js";
|
|
6
5
|
|
|
7
6
|
import "./type-extensions.js";
|
|
@@ -33,12 +32,6 @@ const hardhatPlugin: HardhatPlugin = {
|
|
|
33
32
|
name: "noCompile",
|
|
34
33
|
description: "Do not compile the project before running the tests",
|
|
35
34
|
})
|
|
36
|
-
.addLevel({
|
|
37
|
-
name: "verbosity",
|
|
38
|
-
shortName: "v",
|
|
39
|
-
description: "Verbosity level of the test output",
|
|
40
|
-
defaultValue: DEFAULT_VERBOSITY,
|
|
41
|
-
})
|
|
42
35
|
.setAction(async () => import("./task-action.js"))
|
|
43
36
|
.build(),
|
|
44
37
|
],
|
|
@@ -7,10 +7,7 @@ import type {
|
|
|
7
7
|
import type { TestSummary } from "../../../types/test.js";
|
|
8
8
|
import type { Result } from "../../../types/utils.js";
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
assertHardhatInvariant,
|
|
12
|
-
HardhatError,
|
|
13
|
-
} from "@nomicfoundation/hardhat-errors";
|
|
10
|
+
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
14
11
|
import { isObject } from "@nomicfoundation/hardhat-utils/lang";
|
|
15
12
|
import chalk, { type ChalkInstance } from "chalk";
|
|
16
13
|
|
|
@@ -19,14 +16,14 @@ import {
|
|
|
19
16
|
isResult,
|
|
20
17
|
successfulResult,
|
|
21
18
|
} from "../../../utils/result.js";
|
|
22
|
-
import {
|
|
19
|
+
import { getCoverageManager } from "../coverage/helpers.js";
|
|
20
|
+
import { getGasAnalyticsManager } from "../gas-analytics/helpers.js";
|
|
23
21
|
|
|
24
22
|
interface TestActionArguments {
|
|
25
23
|
testFiles: string[];
|
|
26
24
|
chainType: string;
|
|
27
25
|
grep: string | undefined;
|
|
28
26
|
noCompile: boolean;
|
|
29
|
-
verbosity: number;
|
|
30
27
|
}
|
|
31
28
|
|
|
32
29
|
// Old plugins may only return { failed, passed } without skipped/todo,
|
|
@@ -53,7 +50,7 @@ function isTestRunResult(
|
|
|
53
50
|
}
|
|
54
51
|
|
|
55
52
|
const runAllTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
56
|
-
{ testFiles, chainType, grep, noCompile,
|
|
53
|
+
{ testFiles, chainType, grep, noCompile, ...otherArgs },
|
|
57
54
|
hre,
|
|
58
55
|
): Promise<Result<void, void>> => {
|
|
59
56
|
// If this code is executed, it means the user has not specified a test runner.
|
|
@@ -73,18 +70,22 @@ const runAllTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
73
70
|
}
|
|
74
71
|
|
|
75
72
|
if (hre.globalOptions.coverage === true) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
hre.
|
|
73
|
+
getCoverageManager(hre).disableReport();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (
|
|
77
|
+
hre.globalOptions.gasStats === true ||
|
|
78
|
+
hre.globalOptions.gasStatsJson !== undefined
|
|
79
|
+
) {
|
|
80
|
+
getGasAnalyticsManager(hre).disableReport();
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
const testSummaries: Record<string, TestSummary> = {};
|
|
84
|
+
const ranSubtaskIds: string[] = [];
|
|
84
85
|
|
|
85
86
|
let failureIndex = 1;
|
|
86
87
|
let hasFailures = false;
|
|
87
|
-
for (const subtask of thisTask.subtasks.
|
|
88
|
+
for (const [subtaskKey, subtask] of thisTask.subtasks.entries()) {
|
|
88
89
|
const files = getTestFilesForSubtask(subtask, testFiles, subtasksToFiles);
|
|
89
90
|
|
|
90
91
|
if (files === undefined) {
|
|
@@ -93,6 +94,8 @@ const runAllTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
93
94
|
continue;
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
ranSubtaskIds.push(subtaskKey);
|
|
98
|
+
|
|
96
99
|
const args: TaskArguments = {
|
|
97
100
|
testFiles: files,
|
|
98
101
|
grep,
|
|
@@ -103,10 +106,6 @@ const runAllTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
103
106
|
args.chainType = chainType;
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
if (subtask.options.has("verbosity")) {
|
|
107
|
-
args.verbosity = verbosity;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
109
|
for (const [key, value] of Object.entries(otherArgs)) {
|
|
111
110
|
if (subtask.options.has(key)) {
|
|
112
111
|
args[key] = value;
|
|
@@ -228,16 +227,32 @@ const runAllTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
228
227
|
console.log();
|
|
229
228
|
|
|
230
229
|
if (hre.globalOptions.coverage === true) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
);
|
|
235
|
-
const ids = Array.from(thisTask.subtasks.keys());
|
|
236
|
-
hre._coverage.enableReport();
|
|
237
|
-
await hre._coverage.report(...ids);
|
|
230
|
+
const coverage = getCoverageManager(hre);
|
|
231
|
+
coverage.enableReport();
|
|
232
|
+
await coverage.report(...ranSubtaskIds);
|
|
238
233
|
console.log();
|
|
239
234
|
}
|
|
240
235
|
|
|
236
|
+
if (
|
|
237
|
+
hre.globalOptions.gasStats === true ||
|
|
238
|
+
hre.globalOptions.gasStatsJson !== undefined
|
|
239
|
+
) {
|
|
240
|
+
const gasAnalytics = getGasAnalyticsManager(hre);
|
|
241
|
+
gasAnalytics.enableReport();
|
|
242
|
+
|
|
243
|
+
if (hre.globalOptions.gasStats === true) {
|
|
244
|
+
await gasAnalytics.reportGasStats(...ranSubtaskIds);
|
|
245
|
+
console.log();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (hre.globalOptions.gasStatsJson !== undefined) {
|
|
249
|
+
await gasAnalytics.writeGasStatsJson(
|
|
250
|
+
hre.globalOptions.gasStatsJson,
|
|
251
|
+
...ranSubtaskIds,
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
241
256
|
if (hasFailures) {
|
|
242
257
|
console.error("Test run failed");
|
|
243
258
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { GlobalOptionDefinitions } from "../../../types/global-options.js";
|
|
2
2
|
import type { Task } from "../../../types/tasks.js";
|
|
3
3
|
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
|
|
4
6
|
import {
|
|
5
7
|
GLOBAL_NAME_PADDING,
|
|
6
8
|
parseOptions,
|
|
@@ -15,8 +17,6 @@ export async function getHelpString(
|
|
|
15
17
|
task: Task,
|
|
16
18
|
globalOptionDefinitions: GlobalOptionDefinitions,
|
|
17
19
|
): Promise<string> {
|
|
18
|
-
const { default: chalk } = await import("chalk");
|
|
19
|
-
|
|
20
20
|
const { options, positionalArguments } = parseOptions(task);
|
|
21
21
|
|
|
22
22
|
const subtasks = parseSubtasks(task);
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
getHardhatVersion,
|
|
30
30
|
getLatestHardhatVersion,
|
|
31
31
|
} from "../../utils/package.js";
|
|
32
|
+
import { BannerManager } from "../banner-manager.js";
|
|
32
33
|
import { sendProjectTypeAnalytics } from "../telemetry/analytics/analytics.js";
|
|
33
34
|
import { sendErrorTelemetry } from "../telemetry/sentry/reporter.js";
|
|
34
35
|
|
|
@@ -133,7 +134,6 @@ export async function initHardhat(options?: InitHardhatOptions): Promise<void> {
|
|
|
133
134
|
showStarOnGitHubMessage();
|
|
134
135
|
|
|
135
136
|
try {
|
|
136
|
-
const { BannerManager } = await import("../banner-manager.js");
|
|
137
137
|
const bannerManager = await BannerManager.getInstance();
|
|
138
138
|
await bannerManager.showBanner();
|
|
139
139
|
} catch (bannerError) {
|
|
@@ -3,14 +3,13 @@ import type { Template } from "./template.js";
|
|
|
3
3
|
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
4
4
|
import { shortenPath } from "@nomicfoundation/hardhat-utils/path";
|
|
5
5
|
import chalk from "chalk";
|
|
6
|
+
import enquirer from "enquirer";
|
|
6
7
|
|
|
7
8
|
export async function promptForHardhatVersion(): Promise<
|
|
8
9
|
"hardhat-2" | "hardhat-3"
|
|
9
10
|
> {
|
|
10
11
|
ensureTTY();
|
|
11
12
|
|
|
12
|
-
const { default: enquirer } = await import("enquirer");
|
|
13
|
-
|
|
14
13
|
const hardhatVersionResponse = await enquirer.prompt<{
|
|
15
14
|
hardhatVersion: "hardhat-2" | "hardhat-3";
|
|
16
15
|
}>([
|
|
@@ -40,8 +39,6 @@ export async function promptForHardhatVersion(): Promise<
|
|
|
40
39
|
export async function promptForWorkspace(): Promise<string> {
|
|
41
40
|
ensureTTY();
|
|
42
41
|
|
|
43
|
-
const { default: enquirer } = await import("enquirer");
|
|
44
|
-
|
|
45
42
|
const workspaceResponse = await enquirer.prompt<{ workspace: string }>([
|
|
46
43
|
{
|
|
47
44
|
name: "workspace",
|
|
@@ -59,8 +56,6 @@ export async function promptForMigrateToEsm(
|
|
|
59
56
|
): Promise<boolean> {
|
|
60
57
|
ensureTTY();
|
|
61
58
|
|
|
62
|
-
const { default: enquirer } = await import("enquirer");
|
|
63
|
-
|
|
64
59
|
const migrateToEsmResponse = await enquirer.prompt<{ migrateToEsm: boolean }>(
|
|
65
60
|
[
|
|
66
61
|
{
|
|
@@ -80,8 +75,6 @@ export async function promptForTemplate(
|
|
|
80
75
|
): Promise<string> {
|
|
81
76
|
ensureTTY();
|
|
82
77
|
|
|
83
|
-
const { default: enquirer } = await import("enquirer");
|
|
84
|
-
|
|
85
78
|
const templateResponse = await enquirer.prompt<{ template: string }>([
|
|
86
79
|
{
|
|
87
80
|
name: "template",
|
|
@@ -102,8 +95,6 @@ export async function promptForTemplate(
|
|
|
102
95
|
export async function promptForForce(files: string[]): Promise<boolean> {
|
|
103
96
|
ensureTTY();
|
|
104
97
|
|
|
105
|
-
const { default: enquirer } = await import("enquirer");
|
|
106
|
-
|
|
107
98
|
const forceResponse = await enquirer.prompt<{ force: boolean }>([
|
|
108
99
|
{
|
|
109
100
|
name: "force",
|
|
@@ -121,8 +112,6 @@ export async function promptForInstall(
|
|
|
121
112
|
): Promise<boolean> {
|
|
122
113
|
ensureTTY();
|
|
123
114
|
|
|
124
|
-
const { default: enquirer } = await import("enquirer");
|
|
125
|
-
|
|
126
115
|
const installResponse = await enquirer.prompt<{ install: boolean }>([
|
|
127
116
|
{
|
|
128
117
|
name: "install",
|
|
@@ -140,8 +129,6 @@ export async function promptForUpdate(
|
|
|
140
129
|
): Promise<boolean> {
|
|
141
130
|
ensureTTY();
|
|
142
131
|
|
|
143
|
-
const { default: enquirer } = await import("enquirer");
|
|
144
|
-
|
|
145
132
|
const updateResponse = await enquirer.prompt<{ update: boolean }>([
|
|
146
133
|
{
|
|
147
134
|
name: "update",
|