hardhat 3.4.2 → 3.4.4

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.
Files changed (253) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/src/internal/builtin-plugins/console/task-action.js +4 -4
  3. package/dist/src/internal/builtin-plugins/console/task-action.js.map +1 -1
  4. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.d.ts +1 -1
  5. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.d.ts.map +1 -1
  6. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js +16 -16
  7. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js.map +1 -1
  8. package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js +1 -1
  9. package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js.map +1 -1
  10. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +2 -2
  11. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
  12. package/dist/src/internal/builtin-plugins/coverage/instrumentation.d.ts.map +1 -1
  13. package/dist/src/internal/builtin-plugins/coverage/instrumentation.js +7 -2
  14. package/dist/src/internal/builtin-plugins/coverage/instrumentation.js.map +1 -1
  15. package/dist/src/internal/builtin-plugins/coverage/process-coverage.js +6 -6
  16. package/dist/src/internal/builtin-plugins/coverage/process-coverage.js.map +1 -1
  17. package/dist/src/internal/builtin-plugins/flatten/task-action.d.ts.map +1 -1
  18. package/dist/src/internal/builtin-plugins/flatten/task-action.js +4 -4
  19. package/dist/src/internal/builtin-plugins/flatten/task-action.js.map +1 -1
  20. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.d.ts.map +1 -1
  21. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js +10 -10
  22. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js.map +1 -1
  23. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts.map +1 -1
  24. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +12 -9
  25. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js.map +1 -1
  26. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js +1 -1
  27. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js.map +1 -1
  28. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.js +2 -2
  29. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.js.map +1 -1
  30. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts.map +1 -1
  31. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +9 -9
  32. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
  33. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts.map +1 -1
  34. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js +5 -5
  35. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js.map +1 -1
  36. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +2 -2
  37. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
  38. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts +2 -2
  39. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts.map +1 -1
  40. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js +21 -24
  41. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js.map +1 -1
  42. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.d.ts.map +1 -1
  43. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js +13 -11
  44. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js.map +1 -1
  45. package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js +2 -2
  46. package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js.map +1 -1
  47. package/dist/src/internal/builtin-plugins/node/helpers.d.ts +2 -1
  48. package/dist/src/internal/builtin-plugins/node/helpers.d.ts.map +1 -1
  49. package/dist/src/internal/builtin-plugins/node/helpers.js +3 -3
  50. package/dist/src/internal/builtin-plugins/node/helpers.js.map +1 -1
  51. package/dist/src/internal/builtin-plugins/node/json-rpc/server.js +2 -2
  52. package/dist/src/internal/builtin-plugins/node/json-rpc/server.js.map +1 -1
  53. package/dist/src/internal/builtin-plugins/node/task-action.d.ts.map +1 -1
  54. package/dist/src/internal/builtin-plugins/node/task-action.js +4 -4
  55. package/dist/src/internal/builtin-plugins/node/task-action.js.map +1 -1
  56. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
  57. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +18 -9
  58. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
  59. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.d.ts +8 -0
  60. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.d.ts.map +1 -0
  61. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.js +46 -0
  62. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.js.map +1 -0
  63. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.d.ts.map +1 -1
  64. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js +9 -3
  65. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js.map +1 -1
  66. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts.map +1 -1
  67. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +2 -2
  68. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
  69. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js +2 -2
  70. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js.map +1 -1
  71. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.d.ts.map +1 -1
  72. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js +7 -19
  73. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js.map +1 -1
  74. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.d.ts.map +1 -1
  75. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js +4 -3
  76. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js.map +1 -1
  77. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts +2 -1
  78. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts.map +1 -1
  79. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.js +12 -8
  80. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.js.map +1 -1
  81. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts +3 -2
  82. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts.map +1 -1
  83. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js +15 -6
  84. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js.map +1 -1
  85. package/dist/src/internal/builtin-plugins/solidity/config.d.ts.map +1 -1
  86. package/dist/src/internal/builtin-plugins/solidity/config.js +2 -2
  87. package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
  88. package/dist/src/internal/builtin-plugins/solidity/constants.d.ts +1 -0
  89. package/dist/src/internal/builtin-plugins/solidity/constants.d.ts.map +1 -1
  90. package/dist/src/internal/builtin-plugins/solidity/constants.js +2 -0
  91. package/dist/src/internal/builtin-plugins/solidity/constants.js.map +1 -1
  92. package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts.map +1 -1
  93. package/dist/src/internal/builtin-plugins/solidity-test/config.js +1 -0
  94. package/dist/src/internal/builtin-plugins/solidity-test/config.js.map +1 -1
  95. package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +1 -2
  96. package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
  97. package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +3 -3
  98. package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
  99. package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts +2 -2
  100. package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts.map +1 -1
  101. package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +19 -17
  102. package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
  103. package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
  104. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +5 -2
  105. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
  106. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts +1 -0
  107. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
  108. package/dist/src/internal/builtin-plugins/test/task-action.d.ts.map +1 -1
  109. package/dist/src/internal/builtin-plugins/test/task-action.js +8 -6
  110. package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
  111. package/dist/src/internal/cli/banner-manager.js +2 -2
  112. package/dist/src/internal/cli/banner-manager.js.map +1 -1
  113. package/dist/src/internal/cli/error-handler.d.ts.map +1 -1
  114. package/dist/src/internal/cli/error-handler.js +6 -6
  115. package/dist/src/internal/cli/error-handler.js.map +1 -1
  116. package/dist/src/internal/cli/help/get-help-string.js +2 -2
  117. package/dist/src/internal/cli/help/get-help-string.js.map +1 -1
  118. package/dist/src/internal/cli/init/init.d.ts.map +1 -1
  119. package/dist/src/internal/cli/init/init.js +40 -28
  120. package/dist/src/internal/cli/init/init.js.map +1 -1
  121. package/dist/src/internal/cli/init/package-manager.d.ts.map +1 -1
  122. package/dist/src/internal/cli/init/package-manager.js +5 -5
  123. package/dist/src/internal/cli/init/package-manager.js.map +1 -1
  124. package/dist/src/internal/cli/init/prompt.d.ts.map +1 -1
  125. package/dist/src/internal/cli/init/prompt.js +3 -3
  126. package/dist/src/internal/cli/init/prompt.js.map +1 -1
  127. package/dist/src/internal/cli/main.d.ts.map +1 -1
  128. package/dist/src/internal/cli/main.js +2 -2
  129. package/dist/src/internal/cli/main.js.map +1 -1
  130. package/dist/src/internal/cli/node-version.js +1 -1
  131. package/dist/src/internal/cli/telemetry/analytics/analytics.js +2 -2
  132. package/dist/src/internal/cli/telemetry/analytics/analytics.js.map +1 -1
  133. package/dist/src/internal/cli/telemetry/analytics/utils.js +2 -2
  134. package/dist/src/internal/cli/telemetry/analytics/utils.js.map +1 -1
  135. package/dist/src/internal/cli/telemetry/error-classification/classifier.d.ts +58 -0
  136. package/dist/src/internal/cli/telemetry/error-classification/classifier.d.ts.map +1 -0
  137. package/dist/src/internal/cli/telemetry/error-classification/classifier.js +402 -0
  138. package/dist/src/internal/cli/telemetry/error-classification/classifier.js.map +1 -0
  139. package/dist/src/internal/cli/telemetry/error-classification/codebase-dependent-helpers.d.ts +67 -0
  140. package/dist/src/internal/cli/telemetry/error-classification/codebase-dependent-helpers.d.ts.map +1 -0
  141. package/dist/src/internal/cli/telemetry/error-classification/codebase-dependent-helpers.js +140 -0
  142. package/dist/src/internal/cli/telemetry/error-classification/codebase-dependent-helpers.js.map +1 -0
  143. package/dist/src/internal/cli/telemetry/error-classification/filter.d.ts +15 -0
  144. package/dist/src/internal/cli/telemetry/error-classification/filter.d.ts.map +1 -0
  145. package/dist/src/internal/cli/telemetry/error-classification/filter.js +114 -0
  146. package/dist/src/internal/cli/telemetry/error-classification/filter.js.map +1 -0
  147. package/dist/src/internal/cli/telemetry/error-classification/helpers.d.ts +52 -0
  148. package/dist/src/internal/cli/telemetry/error-classification/helpers.d.ts.map +1 -0
  149. package/dist/src/internal/cli/telemetry/error-classification/helpers.js +163 -0
  150. package/dist/src/internal/cli/telemetry/error-classification/helpers.js.map +1 -0
  151. package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js +2 -2
  152. package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js.map +1 -1
  153. package/dist/src/internal/cli/telemetry/error-reporter/reporter.d.ts.map +1 -1
  154. package/dist/src/internal/cli/telemetry/error-reporter/reporter.js +14 -0
  155. package/dist/src/internal/cli/telemetry/error-reporter/reporter.js.map +1 -1
  156. package/dist/src/internal/cli/telemetry/sentry/anonymizer.d.ts +0 -2
  157. package/dist/src/internal/cli/telemetry/sentry/anonymizer.d.ts.map +1 -1
  158. package/dist/src/internal/cli/telemetry/sentry/anonymizer.js +0 -117
  159. package/dist/src/internal/cli/telemetry/sentry/anonymizer.js.map +1 -1
  160. package/dist/src/internal/cli/telemetry/sentry/init.d.ts.map +1 -1
  161. package/dist/src/internal/cli/telemetry/sentry/init.js +14 -9
  162. package/dist/src/internal/cli/telemetry/sentry/init.js.map +1 -1
  163. package/dist/src/internal/cli/telemetry/sentry/reporter.d.ts.map +1 -1
  164. package/dist/src/internal/cli/telemetry/sentry/reporter.js +3 -29
  165. package/dist/src/internal/cli/telemetry/sentry/reporter.js.map +1 -1
  166. package/dist/src/internal/cli/telemetry/sentry/subprocess.js +13 -19
  167. package/dist/src/internal/cli/telemetry/sentry/subprocess.js.map +1 -1
  168. package/dist/src/internal/cli/telemetry/sentry/transport.js +2 -2
  169. package/dist/src/internal/cli/telemetry/sentry/transport.js.map +1 -1
  170. package/dist/src/internal/cli/telemetry/telemetry-permissions.js +2 -2
  171. package/dist/src/internal/cli/telemetry/telemetry-permissions.js.map +1 -1
  172. package/dist/src/internal/config-loading.js +2 -2
  173. package/dist/src/internal/config-loading.js.map +1 -1
  174. package/dist/src/internal/core/hook-manager.d.ts.map +1 -1
  175. package/dist/src/internal/core/hook-manager.js +10 -3
  176. package/dist/src/internal/core/hook-manager.js.map +1 -1
  177. package/dist/src/internal/core/user-interruptions.js +4 -4
  178. package/dist/src/internal/core/user-interruptions.js.map +1 -1
  179. package/dist/src/internal/using-hardhat2-plugin-errors.d.ts.map +1 -1
  180. package/dist/src/internal/using-hardhat2-plugin-errors.js +2 -2
  181. package/dist/src/internal/using-hardhat2-plugin-errors.js.map +1 -1
  182. package/package.json +6 -9
  183. package/src/internal/builtin-plugins/console/task-action.ts +4 -4
  184. package/src/internal/builtin-plugins/coverage/coverage-manager.ts +21 -17
  185. package/src/internal/builtin-plugins/coverage/helpers/accessors.ts +1 -1
  186. package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +2 -2
  187. package/src/internal/builtin-plugins/coverage/instrumentation.ts +21 -2
  188. package/src/internal/builtin-plugins/coverage/process-coverage.ts +6 -6
  189. package/src/internal/builtin-plugins/flatten/task-action.ts +8 -4
  190. package/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.ts +11 -10
  191. package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +13 -9
  192. package/src/internal/builtin-plugins/gas-analytics/helpers/accessors.ts +1 -1
  193. package/src/internal/builtin-plugins/gas-analytics/helpers/utils.ts +2 -2
  194. package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +10 -9
  195. package/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.ts +11 -5
  196. package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +2 -2
  197. package/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.ts +23 -23
  198. package/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.ts +14 -11
  199. package/src/internal/builtin-plugins/node/artifacts/build-info-watcher.ts +2 -2
  200. package/src/internal/builtin-plugins/node/helpers.ts +7 -4
  201. package/src/internal/builtin-plugins/node/json-rpc/server.ts +2 -2
  202. package/src/internal/builtin-plugins/node/task-action.ts +5 -4
  203. package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +23 -9
  204. package/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.ts +61 -0
  205. package/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.ts +17 -3
  206. package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +4 -2
  207. package/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +2 -2
  208. package/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.ts +19 -22
  209. package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +9 -1
  210. package/src/internal/builtin-plugins/solidity/build-system/resolver/utils.ts +16 -7
  211. package/src/internal/builtin-plugins/solidity/build-system/solc-info.ts +27 -6
  212. package/src/internal/builtin-plugins/solidity/config.ts +5 -2
  213. package/src/internal/builtin-plugins/solidity/constants.ts +3 -0
  214. package/src/internal/builtin-plugins/solidity-test/config.ts +1 -0
  215. package/src/internal/builtin-plugins/solidity-test/helpers.ts +3 -4
  216. package/src/internal/builtin-plugins/solidity-test/reporter.ts +19 -18
  217. package/src/internal/builtin-plugins/solidity-test/task-action.ts +5 -2
  218. package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +1 -0
  219. package/src/internal/builtin-plugins/test/task-action.ts +12 -6
  220. package/src/internal/cli/banner-manager.ts +2 -2
  221. package/src/internal/cli/error-handler.ts +10 -6
  222. package/src/internal/cli/help/get-help-string.ts +2 -2
  223. package/src/internal/cli/init/init.ts +53 -28
  224. package/src/internal/cli/init/package-manager.ts +8 -6
  225. package/src/internal/cli/init/prompt.ts +4 -3
  226. package/src/internal/cli/main.ts +4 -3
  227. package/src/internal/cli/node-version.ts +1 -1
  228. package/src/internal/cli/telemetry/analytics/analytics.ts +2 -2
  229. package/src/internal/cli/telemetry/analytics/utils.ts +2 -2
  230. package/src/internal/cli/telemetry/error-classification/classifier.ts +636 -0
  231. package/src/internal/cli/telemetry/error-classification/codebase-dependent-helpers.ts +200 -0
  232. package/src/internal/cli/telemetry/error-classification/filter.ts +140 -0
  233. package/src/internal/cli/telemetry/error-classification/helpers.ts +235 -0
  234. package/src/internal/cli/telemetry/error-reporter/global-error-handlers.ts +2 -2
  235. package/src/internal/cli/telemetry/error-reporter/reporter.ts +21 -0
  236. package/src/internal/cli/telemetry/sentry/anonymizer.ts +0 -168
  237. package/src/internal/cli/telemetry/sentry/init.ts +42 -33
  238. package/src/internal/cli/telemetry/sentry/reporter.ts +4 -47
  239. package/src/internal/cli/telemetry/sentry/subprocess.ts +13 -21
  240. package/src/internal/cli/telemetry/sentry/transport.ts +2 -2
  241. package/src/internal/cli/telemetry/telemetry-permissions.ts +2 -2
  242. package/src/internal/config-loading.ts +2 -2
  243. package/src/internal/core/hook-manager.ts +21 -3
  244. package/src/internal/core/user-interruptions.ts +4 -4
  245. package/src/internal/using-hardhat2-plugin-errors.ts +2 -2
  246. package/templates/hardhat-3/01-node-test-runner-viem/package.json +7 -7
  247. package/templates/hardhat-3/02-mocha-ethers/package.json +12 -12
  248. package/templates/hardhat-3/03-minimal/package.json +1 -1
  249. package/dist/src/internal/utils/colorizer.d.ts +0 -10
  250. package/dist/src/internal/utils/colorizer.d.ts.map +0 -1
  251. package/dist/src/internal/utils/colorizer.js +0 -2
  252. package/dist/src/internal/utils/colorizer.js.map +0 -1
  253. package/src/internal/utils/colorizer.ts +0 -9
@@ -7,7 +7,9 @@ import type {
7
7
  import type { TableItem } from "@nomicfoundation/hardhat-utils/format";
8
8
 
9
9
  import path from "node:path";
10
+ import { styleText } from "node:util";
10
11
 
12
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
11
13
  import { formatTable } from "@nomicfoundation/hardhat-utils/format";
12
14
  import {
13
15
  ensureDir,
@@ -18,13 +20,11 @@ import {
18
20
  writeJsonFile,
19
21
  writeUtf8File,
20
22
  } from "@nomicfoundation/hardhat-utils/fs";
21
- import chalk from "chalk";
22
- import debug from "debug";
23
23
 
24
24
  import { getProcessedCoverageInfo } from "./process-coverage.js";
25
25
  import { generateHtmlReport } from "./reports/html.js";
26
26
 
27
- const log = debug("hardhat:core:coverage:coverage-manager");
27
+ const log = createDebug("hardhat:core:coverage:coverage-manager");
28
28
 
29
29
  const MAX_COLUMN_WIDTH = 80;
30
30
 
@@ -74,7 +74,7 @@ export class CoverageManagerImplementation implements CoverageManager {
74
74
  /**
75
75
  * @private exposed for testing purposes only
76
76
  */
77
- public data: CoverageData = [];
77
+ public data: Map<string, number> = new Map();
78
78
 
79
79
  readonly #coveragePath: string;
80
80
 
@@ -91,8 +91,8 @@ export class CoverageManagerImplementation implements CoverageManager {
91
91
  }
92
92
 
93
93
  public async addData(data: CoverageData): Promise<void> {
94
- for (const entry of data) {
95
- this.data.push(entry);
94
+ for (const tag of data) {
95
+ this.data.set(tag, (this.data.get(tag) ?? 0) + 1);
96
96
  }
97
97
 
98
98
  log("Added data", JSON.stringify(data, null, 2));
@@ -122,14 +122,14 @@ export class CoverageManagerImplementation implements CoverageManager {
122
122
  public async clearData(id: string): Promise<void> {
123
123
  const dataPath = await this.#getDataPath(id);
124
124
  await remove(dataPath);
125
- this.data = [];
125
+ this.data = new Map();
126
126
  log("Cleared data from disk and memory");
127
127
  }
128
128
 
129
129
  public async saveData(id: string): Promise<void> {
130
130
  const dataPath = await this.#getDataPath(id);
131
131
  const filePath = path.join(dataPath, `${crypto.randomUUID()}.json`);
132
- const data = this.data;
132
+ const data = Object.fromEntries(this.data);
133
133
  await writeJsonFile(filePath, data);
134
134
  log("Saved data", id, filePath);
135
135
  }
@@ -170,15 +170,19 @@ export class CoverageManagerImplementation implements CoverageManager {
170
170
  * @private exposed for testing purposes only
171
171
  */
172
172
  public async loadData(...ids: string[]): Promise<void> {
173
- this.data = [];
173
+ this.data = new Map();
174
+
174
175
  for (const id of ids) {
175
176
  const dataPath = await this.#getDataPath(id);
176
177
  const filePaths = await getAllFilesMatching(dataPath);
178
+
177
179
  for (const filePath of filePaths) {
178
- const entries = await readJsonFile<CoverageData>(filePath);
179
- for (const entry of entries) {
180
- this.data.push(entry);
180
+ const entries = await readJsonFile<Record<string, number>>(filePath);
181
+
182
+ for (const [tag, count] of Object.entries(entries)) {
183
+ this.data.set(tag, (this.data.get(tag) ?? 0) + count);
181
184
  }
185
+
182
186
  log("Loaded data", id, filePath);
183
187
  }
184
188
  }
@@ -188,7 +192,7 @@ export class CoverageManagerImplementation implements CoverageManager {
188
192
  * @private exposed for testing purposes only
189
193
  */
190
194
  public async getReport(): Promise<Report> {
191
- const allExecutedTags = new Set(this.data);
195
+ const allExecutedTags = this.data;
192
196
 
193
197
  const reportPromises = Array.from(this.filesMetadata.entries()).map(
194
198
  async ([fileRelativePath, fileStatements]) => {
@@ -435,18 +439,18 @@ export class CoverageManagerImplementation implements CoverageManager {
435
439
 
436
440
  rows.push({
437
441
  type: "title",
438
- text: chalk.bold("Coverage Report"),
442
+ text: styleText("bold", "Coverage Report"),
439
443
  });
440
444
 
441
445
  rows.push({
442
446
  type: "section-header",
443
- text: chalk.bold("File Coverage"),
447
+ text: styleText("bold", "File Coverage"),
444
448
  });
445
449
 
446
450
  rows.push({
447
451
  type: "header",
448
452
  cells: ["File Path", "Line %", "Statement %", "Uncovered Lines"].map(
449
- (s) => chalk.yellow(s),
453
+ (s) => styleText("yellow", s),
450
454
  ),
451
455
  });
452
456
 
@@ -500,7 +504,7 @@ export class CoverageManagerImplementation implements CoverageManager {
500
504
  rows.push({
501
505
  type: "header",
502
506
  cells: [
503
- chalk.yellow("Total"),
507
+ styleText("yellow", "Total"),
504
508
  this.formatCoverage(totalLineCoverage),
505
509
  this.formatCoverage(totalStatementCoverage),
506
510
  "",
@@ -2,7 +2,7 @@
2
2
  // handler and task-actions that may run on every `hardhat test` invocation
3
3
  // regardless of whether the feature is enabled. It must stay lightweight:
4
4
  // do not add top-level imports that pull in the coverage-manager module
5
- // graph (chalk, debug, node:crypto, file-system traversal, etc.), or the
5
+ // graph (debug, node:crypto, file-system traversal, etc.), or the
6
6
  // `--coverage` lazy-load is silently defeated for every caller.
7
7
  // If a new helper needs a heavy dependency, put it in a sibling file
8
8
  // (e.g. `helpers/utils.ts`) so the accessors file's import cost stays flat.
@@ -4,15 +4,15 @@ import type { CoverageMetadata } from "../types.js";
4
4
  import path from "node:path";
5
5
 
6
6
  import { HardhatError } from "@nomicfoundation/hardhat-errors";
7
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
7
8
  import { ensureError } from "@nomicfoundation/hardhat-utils/error";
8
9
  import { readUtf8File } from "@nomicfoundation/hardhat-utils/fs";
9
10
  import { findClosestPackageRoot } from "@nomicfoundation/hardhat-utils/package";
10
- import debug from "debug";
11
11
 
12
12
  import { getCoverageManager } from "../helpers/accessors.js";
13
13
  import { instrumentSolidityFileForCompilationJob } from "../instrumentation.js";
14
14
 
15
- const log = debug("hardhat:core:coverage:hook-handlers:solidity");
15
+ const log = createDebug("hardhat:core:coverage:hook-handlers:solidity");
16
16
 
17
17
  const COVERAGE_LIBRARY_PATH =
18
18
  "__hardhat_coverage_library_a3e9cfe2-41b4-4a1f-ad9e-ac62dd82979e.sol";
@@ -4,7 +4,11 @@ import {
4
4
  addStatementCoverageInstrumentation,
5
5
  latestSupportedSolidityVersion,
6
6
  } from "@nomicfoundation/edr";
7
- import { satisfies } from "semver";
7
+ import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
8
+ import {
9
+ lowerThanOrEqual,
10
+ parseVersion,
11
+ } from "@nomicfoundation/hardhat-utils/fast-semver";
8
12
 
9
13
  /**
10
14
  * Instruments a solidity source file as part of a compilation job. i.e. the
@@ -37,8 +41,23 @@ export function instrumentSolidityFileForCompilationJob({
37
41
  instrumentationVersion: string;
38
42
  } {
39
43
  const latestSupportedVersion = latestSupportedSolidityVersion();
44
+ const parsedLatestSupportedVersion = parseVersion(latestSupportedVersion);
45
+ assertHardhatInvariant(
46
+ parsedLatestSupportedVersion !== undefined,
47
+ `Invalid latest supported solidity version: ${latestSupportedVersion}`,
48
+ );
40
49
  let instrumentationVersion = compilationJobSolcVersion;
41
- if (!satisfies(instrumentationVersion, `<=${latestSupportedVersion}`)) {
50
+ const parsedInstrumentationVersion = parseVersion(instrumentationVersion);
51
+ assertHardhatInvariant(
52
+ parsedInstrumentationVersion !== undefined,
53
+ `Invalid solc version: ${instrumentationVersion}`,
54
+ );
55
+ if (
56
+ !lowerThanOrEqual(
57
+ parsedInstrumentationVersion,
58
+ parsedLatestSupportedVersion,
59
+ )
60
+ ) {
42
61
  instrumentationVersion = latestSupportedVersion;
43
62
  }
44
63
  const { source, metadata } = addStatementCoverageInstrumentation(
@@ -4,7 +4,7 @@ import type {
4
4
  Statement,
5
5
  } from "./types.js";
6
6
 
7
- import chalk from "chalk";
7
+ import { styleText } from "node:util";
8
8
 
9
9
  // Use constants for the Uint8Array to improve memory usage (1 byte vs 8 bytes per item)
10
10
  const STATUS_NOT_EXECUTED = 0; // equivalent to false
@@ -399,7 +399,7 @@ function printStatementsForDebugging(
399
399
  console.debug(counter++ + " ---");
400
400
 
401
401
  for (let i = statement.startUtf16; i < statement.endUtf16; i++) {
402
- process.stdout.write(chalk.gray(fileContent[i]));
402
+ process.stdout.write(styleText("gray", fileContent[i]));
403
403
  }
404
404
 
405
405
  console.debug();
@@ -413,7 +413,7 @@ function printStatementsForDebugging(
413
413
  console.debug(counter++ + " ---");
414
414
 
415
415
  for (let i = statement.startUtf16; i < statement.endUtf16; i++) {
416
- process.stdout.write(chalk.gray(fileContent[i]));
416
+ process.stdout.write(styleText("gray", fileContent[i]));
417
417
  }
418
418
 
419
419
  console.debug();
@@ -432,11 +432,11 @@ function printCharacterCoverageForDebugging(
432
432
  ): void {
433
433
  for (let i = 0; i < characterCoverage.length; i++) {
434
434
  if (characterCoverage[i] === STATUS_IGNORED) {
435
- process.stdout.write(chalk.gray(fileContent[i]));
435
+ process.stdout.write(styleText("gray", fileContent[i]));
436
436
  } else if (characterCoverage[i] === STATUS_EXECUTED) {
437
- process.stdout.write(chalk.green(fileContent[i]));
437
+ process.stdout.write(styleText("green", fileContent[i]));
438
438
  } else {
439
- process.stdout.write(chalk.red(fileContent[i]));
439
+ process.stdout.write(styleText("red", fileContent[i]));
440
440
  }
441
441
  }
442
442
  }
@@ -1,7 +1,8 @@
1
1
  import type { NewTaskActionFunction } from "../../../types/tasks.js";
2
2
 
3
+ import { styleText } from "node:util";
4
+
3
5
  import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path";
4
- import chalk from "chalk";
5
6
 
6
7
  import {
7
8
  ResolvedFileType,
@@ -108,7 +109,8 @@ const flattenAction: NewTaskActionFunction<FlattenActionArguments> = async (
108
109
 
109
110
  if (filesWithoutLicenses.length > 0) {
110
111
  warn(
111
- chalk.yellow(
112
+ styleText(
113
+ "yellow",
112
114
  `\nThe following file(s) do NOT specify SPDX licenses: ${filesWithoutLicenses.join(
113
115
  ", ",
114
116
  )}`,
@@ -118,7 +120,8 @@ const flattenAction: NewTaskActionFunction<FlattenActionArguments> = async (
118
120
 
119
121
  if (pragmaDirective !== "" && filesWithoutPragmaDirectives.length > 0) {
120
122
  warn(
121
- chalk.yellow(
123
+ styleText(
124
+ "yellow",
122
125
  `\nPragma abicoder directives are defined in some files, but they are not defined in the following ones: ${filesWithoutPragmaDirectives.join(
123
126
  ", ",
124
127
  )}`,
@@ -128,7 +131,8 @@ const flattenAction: NewTaskActionFunction<FlattenActionArguments> = async (
128
131
 
129
132
  if (filesWithDifferentPragmaDirectives.length > 0) {
130
133
  warn(
131
- chalk.yellow(
134
+ styleText(
135
+ "yellow",
132
136
  `\nThe flattened file is using the pragma abicoder directive '${pragmaDirective}' but these files have a different pragma abicoder directive: ${filesWithDifferentPragmaDirectives.join(
133
137
  ", ",
134
138
  )}`,
@@ -1,6 +1,7 @@
1
1
  import type { SuiteResult } from "@nomicfoundation/edr";
2
2
 
3
3
  import path from "node:path";
4
+ import { styleText } from "node:util";
4
5
 
5
6
  import { HardhatError } from "@nomicfoundation/hardhat-errors";
6
7
  import { ensureError } from "@nomicfoundation/hardhat-utils/error";
@@ -10,7 +11,6 @@ import {
10
11
  writeUtf8File,
11
12
  } from "@nomicfoundation/hardhat-utils/fs";
12
13
  import { findDuplicates } from "@nomicfoundation/hardhat-utils/lang";
13
- import chalk from "chalk";
14
14
 
15
15
  import {
16
16
  getFullyQualifiedName,
@@ -388,7 +388,8 @@ export function logFunctionGasSnapshotsSection(
388
388
  if (isFirstTimeWrite) {
389
389
  logger();
390
390
  logger(
391
- chalk.green(
391
+ styleText(
392
+ "green",
392
393
  " No existing snapshots found. Function gas snapshots written successfully",
393
394
  ),
394
395
  );
@@ -408,7 +409,7 @@ export function logFunctionGasSnapshotsSection(
408
409
  "\n",
409
410
  );
410
411
  for (const line of addedLines) {
411
- logger(chalk.green(` + ${line}`));
412
+ logger(styleText("green", ` + ${line}`));
412
413
  }
413
414
  }
414
415
 
@@ -419,7 +420,7 @@ export function logFunctionGasSnapshotsSection(
419
420
  comparison.removed,
420
421
  ).split("\n");
421
422
  for (const line of removedLines) {
422
- logger(chalk.red(` - ${line}`));
423
+ logger(styleText("red", ` - ${line}`));
423
424
  }
424
425
  }
425
426
 
@@ -435,10 +436,10 @@ export function printFunctionGasSnapshotChanges(
435
436
  const isLast = i === changes.length - 1;
436
437
 
437
438
  logger(` ${change.contractNameOrFqn}#${change.functionSig}`);
438
- logger(chalk.grey(` (in ${change.source})`));
439
+ logger(styleText("grey", ` (in ${change.source})`));
439
440
 
440
441
  if (change.kind === "fuzz") {
441
- logger(chalk.grey(` Runs: ${change.runs}`));
442
+ logger(styleText("grey", ` Runs: ${change.runs}`));
442
443
  }
443
444
 
444
445
  const diff = change.actual - change.expected;
@@ -454,15 +455,15 @@ export function printFunctionGasSnapshotChanges(
454
455
 
455
456
  // Color: green for decrease (improvement), red for increase (regression)
456
457
  const formattedGasChange =
457
- diff < 0 ? chalk.green(gasChange) : chalk.red(gasChange);
458
+ diff < 0 ? styleText("green", gasChange) : styleText("red", gasChange);
458
459
 
459
460
  const label = change.kind === "fuzz" ? "~" : "gas";
460
461
 
461
- logger(chalk.grey(` Expected (${label}): ${change.expected}`));
462
+ logger(styleText("grey", ` Expected (${label}): ${change.expected}`));
462
463
  logger(
463
- chalk.grey(` Actual (${label}): ${change.actual} (`) +
464
+ styleText("grey", ` Actual (${label}): ${change.actual} (`) +
464
465
  formattedGasChange +
465
- chalk.grey(")"),
466
+ styleText("grey", ")"),
466
467
  );
467
468
 
468
469
  if (!isLast) {
@@ -10,11 +10,13 @@ import type { TableItem } from "@nomicfoundation/hardhat-utils/format";
10
10
 
11
11
  import crypto from "node:crypto";
12
12
  import path from "node:path";
13
+ import { styleText } from "node:util";
13
14
 
14
15
  import {
15
16
  HardhatError,
16
17
  assertHardhatInvariant,
17
18
  } from "@nomicfoundation/hardhat-errors";
19
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
18
20
  import { formatTable } from "@nomicfoundation/hardhat-utils/format";
19
21
  import {
20
22
  ensureDir,
@@ -26,8 +28,6 @@ import {
26
28
  writeJsonFile,
27
29
  } from "@nomicfoundation/hardhat-utils/fs";
28
30
  import { findDuplicates } from "@nomicfoundation/hardhat-utils/lang";
29
- import chalk from "chalk";
30
- import debug from "debug";
31
31
 
32
32
  import { parseFullyQualifiedName } from "../../../utils/contract-names.js";
33
33
 
@@ -41,7 +41,7 @@ import {
41
41
  median,
42
42
  } from "./helpers/utils.js";
43
43
 
44
- const gasStatsLog = debug(
44
+ const gasStatsLog = createDebug(
45
45
  "hardhat:core:gas-analytics:gas-analytics-manager:gas-stats",
46
46
  );
47
47
 
@@ -311,7 +311,10 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
311
311
  const rows: TableItem[] = [];
312
312
 
313
313
  if (gasStatsByContract.size > 0) {
314
- rows.push({ type: "title", text: chalk.bold("Gas Usage Statistics") });
314
+ rows.push({
315
+ type: "title",
316
+ text: styleText("bold", "Gas Usage Statistics"),
317
+ });
315
318
  }
316
319
 
317
320
  const sortedContracts = getSortedContractEntries(gasStatsByContract);
@@ -322,8 +325,9 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
322
325
  } of sortedContracts) {
323
326
  rows.push({
324
327
  type: "section-header",
325
- text: chalk.cyan.bold(userFqn),
326
- subtitle: proxyLabel !== undefined ? chalk.cyan(proxyLabel) : undefined,
328
+ text: styleText(["cyan", "bold"], userFqn),
329
+ subtitle:
330
+ proxyLabel !== undefined ? styleText("cyan", proxyLabel) : undefined,
327
331
  });
328
332
 
329
333
  if (contractGasStats.functions.size > 0) {
@@ -336,7 +340,7 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
336
340
  "Median",
337
341
  "Max",
338
342
  "#calls",
339
- ].map((s) => chalk.yellow(s)),
343
+ ].map((s) => styleText("yellow", s)),
340
344
  });
341
345
  }
342
346
 
@@ -372,7 +376,7 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
372
376
  "Median",
373
377
  "Max",
374
378
  "#deployments",
375
- ].map((s) => chalk.yellow(s)),
379
+ ].map((s) => styleText("yellow", s)),
376
380
  });
377
381
  rows.push({
378
382
  type: "row",
@@ -388,7 +392,7 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
388
392
  rows.push({
389
393
  type: "header",
390
394
  cells: [
391
- chalk.yellow("Bytecode size"),
395
+ styleText("yellow", "Bytecode size"),
392
396
  `${contractGasStats.deployment.runtimeSize}`,
393
397
  ],
394
398
  });
@@ -2,7 +2,7 @@
2
2
  // handler and task-actions that may run on every `hardhat test` invocation
3
3
  // regardless of whether the feature is enabled. It must stay lightweight:
4
4
  // do not add top-level imports that pull in the gas-analytics-manager module
5
- // graph (chalk, debug, node:crypto, file-system traversal, etc.), or the
5
+ // graph (debug, node:crypto, file-system traversal, etc.), or the
6
6
  // `--gas-stats` lazy-load is silently defeated for every caller.
7
7
  // If a new helper needs a heavy dependency, put it in a sibling file
8
8
  // (e.g. `helpers/utils.ts`) so the accessors file's import cost stays flat.
@@ -1,4 +1,4 @@
1
- import chalk from "chalk";
1
+ import { styleText } from "node:util";
2
2
 
3
3
  /**
4
4
  * Converts an internal FQN (e.g. `"project/contracts/Foo.sol:Foo"` or
@@ -108,5 +108,5 @@ export function formatSectionHeader(
108
108
  parts.push(`${removedLength} removed`);
109
109
  }
110
110
 
111
- return `${sectionName}: ${chalk.gray(parts.join(", "))}`;
111
+ return `${sectionName}: ${styleText("gray", parts.join(", "))}`;
112
112
  }
@@ -1,6 +1,7 @@
1
1
  import type { SuiteResult } from "@nomicfoundation/edr";
2
2
 
3
3
  import path from "node:path";
4
+ import { styleText } from "node:util";
4
5
 
5
6
  import { HardhatError } from "@nomicfoundation/hardhat-errors";
6
7
  import { ensureError } from "@nomicfoundation/hardhat-utils/error";
@@ -12,7 +13,6 @@ import {
12
13
  remove,
13
14
  writeJsonFile,
14
15
  } from "@nomicfoundation/hardhat-utils/fs";
15
- import chalk from "chalk";
16
16
 
17
17
  import {
18
18
  getFullyQualifiedName,
@@ -371,7 +371,8 @@ export function logSnapshotCheatcodesSection(
371
371
  if (isFirstTimeWrite) {
372
372
  logger();
373
373
  logger(
374
- chalk.green(
374
+ styleText(
375
+ "green",
375
376
  " No existing snapshots found. Snapshot cheatcodes written successfully",
376
377
  ),
377
378
  );
@@ -391,7 +392,7 @@ export function logSnapshotCheatcodesSection(
391
392
  "\n",
392
393
  );
393
394
  for (const line of addedLines) {
394
- logger(chalk.green(` + ${line}`));
395
+ logger(styleText("green", ` + ${line}`));
395
396
  }
396
397
  }
397
398
 
@@ -402,7 +403,7 @@ export function logSnapshotCheatcodesSection(
402
403
  "\n",
403
404
  );
404
405
  for (const line of removedLines) {
405
- logger(chalk.red(` - ${line}`));
406
+ logger(styleText("red", ` - ${line}`));
406
407
  }
407
408
  }
408
409
 
@@ -418,7 +419,7 @@ export function printSnapshotCheatcodeChanges(
418
419
  const isLast = i === changes.length - 1;
419
420
 
420
421
  logger(` ${change.group}#${change.name}`);
421
- logger(chalk.grey(` (in ${change.source})`));
422
+ logger(styleText("grey", ` (in ${change.source})`));
422
423
 
423
424
  const diff = change.actual - change.expected;
424
425
  const formattedDiff = diff > 0 ? `Δ+${diff}` : `Δ${diff}`;
@@ -433,13 +434,13 @@ export function printSnapshotCheatcodeChanges(
433
434
 
434
435
  // Color: green for decrease (improvement), red for increase (regression)
435
436
  const formattedGasChange =
436
- diff < 0 ? chalk.green(gasChange) : chalk.red(gasChange);
437
+ diff < 0 ? styleText("green", gasChange) : styleText("red", gasChange);
437
438
 
438
- logger(chalk.grey(` Expected: ${change.expected}`));
439
+ logger(styleText("grey", ` Expected: ${change.expected}`));
439
440
  logger(
440
- chalk.grey(` Actual: ${change.actual} (`) +
441
+ styleText("grey", ` Actual: ${change.actual} (`) +
441
442
  formattedGasChange +
442
- chalk.grey(")"),
443
+ styleText("grey", ")"),
443
444
  );
444
445
 
445
446
  if (!isLast) {
@@ -5,8 +5,9 @@ import type { FunctionGasSnapshotCheckResult } from "../../function-gas-snapshot
5
5
  import type { SnapshotCheatcodesCheckResult } from "../../snapshot-cheatcodes.js";
6
6
  import type { SuiteResult } from "@nomicfoundation/edr";
7
7
 
8
+ import { styleText } from "node:util";
9
+
8
10
  import { HardhatError } from "@nomicfoundation/hardhat-errors";
9
- import chalk from "chalk";
10
11
 
11
12
  import { errorResult } from "../../../../../utils/result.js";
12
13
  import {
@@ -103,7 +104,7 @@ export function logSnapshotResult(
103
104
  logger: typeof console.log = console.log,
104
105
  ): void {
105
106
  if (result.functionGasSnapshotsWritten) {
106
- logger(chalk.green("Function gas snapshots written successfully"));
107
+ logger(styleText("green", "Function gas snapshots written successfully"));
107
108
  logger();
108
109
  }
109
110
  }
@@ -133,8 +134,8 @@ export function logSnapshotCheckResult(
133
134
  ): void {
134
135
  logger(
135
136
  functionGasSnapshotsCheck.passed && snapshotCheatcodesCheck.passed
136
- ? chalk.green("Snapshot check passed")
137
- : chalk.red("Snapshot check failed"),
137
+ ? styleText("green", "Snapshot check passed")
138
+ : styleText("red", "Snapshot check failed"),
138
139
  );
139
140
 
140
141
  const functionGasHasOutput =
@@ -164,7 +165,12 @@ export function logSnapshotCheckResult(
164
165
  logSnapshotCheatcodesSection(snapshotCheatcodesCheck, logger);
165
166
 
166
167
  if (!functionGasSnapshotsCheck.passed || !snapshotCheatcodesCheck.passed) {
167
- logger(chalk.yellow("To update snapshots, run your tests with --snapshot"));
168
+ logger(
169
+ styleText(
170
+ "yellow",
171
+ "To update snapshots, run your tests with --snapshot",
172
+ ),
173
+ );
168
174
  logger();
169
175
  }
170
176
  }
@@ -29,9 +29,9 @@ import {
29
29
  HardhatError,
30
30
  } from "@nomicfoundation/hardhat-errors";
31
31
  import { toSeconds } from "@nomicfoundation/hardhat-utils/date";
32
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
32
33
  import { ensureError } from "@nomicfoundation/hardhat-utils/error";
33
34
  import { numberToHexString } from "@nomicfoundation/hardhat-utils/hex";
34
- import debug from "debug";
35
35
 
36
36
  import { sendErrorTelemetry } from "../../../cli/telemetry/error-reporter/reporter.js";
37
37
  import { EDR_NETWORK_REVERT_SNAPSHOT_EVENT } from "../../../constants.js";
@@ -59,7 +59,7 @@ import {
59
59
  } from "./utils/convert-to-edr.js";
60
60
  import { printLine, replaceLastLine } from "./utils/logger.js";
61
61
 
62
- const log = debug("hardhat:core:hardhat-network:provider");
62
+ const log = createDebug("hardhat:core:network-manager:edr:provider");
63
63
 
64
64
  interface EdrProviderConfig {
65
65
  chainDescriptors: ChainDescriptorsConfig;