hardhat 3.1.2 → 3.1.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 (42) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.d.ts +14 -14
  3. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.d.ts.map +1 -1
  4. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js +66 -110
  5. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js.map +1 -1
  6. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.d.ts.map +1 -1
  7. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +13 -6
  8. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
  9. package/dist/src/internal/builtin-plugins/coverage/process-coverage.d.ts +21 -0
  10. package/dist/src/internal/builtin-plugins/coverage/process-coverage.d.ts.map +1 -0
  11. package/dist/src/internal/builtin-plugins/coverage/process-coverage.js +291 -0
  12. package/dist/src/internal/builtin-plugins/coverage/process-coverage.js.map +1 -0
  13. package/dist/src/internal/builtin-plugins/coverage/reports/html.d.ts +3 -0
  14. package/dist/src/internal/builtin-plugins/coverage/reports/html.d.ts.map +1 -0
  15. package/dist/src/internal/builtin-plugins/coverage/reports/html.js +37 -0
  16. package/dist/src/internal/builtin-plugins/coverage/reports/html.js.map +1 -0
  17. package/dist/src/internal/builtin-plugins/coverage/types.d.ts +9 -3
  18. package/dist/src/internal/builtin-plugins/coverage/types.d.ts.map +1 -1
  19. package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js +1 -1
  20. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts +1 -1
  21. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts.map +1 -1
  22. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +26 -25
  23. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
  24. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts.map +1 -1
  25. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js +3 -0
  26. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js.map +1 -1
  27. package/dist/src/internal/builtin-plugins/test/task-action.d.ts.map +1 -1
  28. package/dist/src/internal/builtin-plugins/test/task-action.js +53 -53
  29. package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
  30. package/package.json +3 -2
  31. package/src/internal/builtin-plugins/coverage/coverage-manager.ts +121 -176
  32. package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +19 -8
  33. package/src/internal/builtin-plugins/coverage/process-coverage.ts +442 -0
  34. package/src/internal/builtin-plugins/coverage/reports/html.ts +56 -0
  35. package/src/internal/builtin-plugins/coverage/types.ts +8 -3
  36. package/src/internal/builtin-plugins/network-manager/config-resolution.ts +1 -1
  37. package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +40 -26
  38. package/src/internal/builtin-plugins/solidity/build-system/solc-info.ts +3 -0
  39. package/src/internal/builtin-plugins/test/task-action.ts +63 -66
  40. package/templates/hardhat-3/01-node-test-runner-viem/package.json +1 -1
  41. package/templates/hardhat-3/02-mocha-ethers/package.json +4 -4
  42. package/templates/hardhat-3/03-minimal/package.json +1 -1
@@ -67,6 +67,9 @@ const defaultEvmTargets: { [key: string]: string } = {
67
67
  "0.8.28": "cancun",
68
68
  "0.8.29": "cancun",
69
69
  "0.8.30": "prague",
70
+ "0.8.31": "osaka",
71
+ "0.8.32": "osaka",
72
+ "0.8.33": "osaka",
70
73
  };
71
74
 
72
75
  export function getEvmVersionFromSolcVersion(
@@ -52,20 +52,16 @@ const runAllTests: NewTaskActionFunction<TestActionArguments> = async (
52
52
  const testSummaries: Record<
53
53
  string,
54
54
  {
55
- failed: number;
56
- passed: number;
57
- skipped: number;
58
- todo: number;
59
- failureOutput: string;
55
+ failed?: number;
56
+ passed?: number;
57
+ skipped?: number;
58
+ todo?: number;
59
+ failureOutput?: string;
60
60
  }
61
61
  > = {};
62
62
 
63
63
  let failureIndex = 1;
64
- const subtasks = Array.from(thisTask.subtasks.values());
65
- const hasMocha = subtasks.some(
66
- (subtask) => subtask.id[subtask.id.length - 1] === "mocha",
67
- );
68
- for (const subtask of subtasks) {
64
+ for (const subtask of thisTask.subtasks.values()) {
69
65
  const files = getTestFilesForSubtask(subtask, testFiles, subtasksToFiles);
70
66
 
71
67
  if (files === undefined) {
@@ -88,86 +84,87 @@ const runAllTests: NewTaskActionFunction<TestActionArguments> = async (
88
84
  args.verbosity = verbosity;
89
85
  }
90
86
 
91
- if (!hasMocha && subtask.options.has("testSummaryIndex")) {
92
- args.testSummaryIndex = failureIndex;
87
+ const summaryId = subtask.id[subtask.id.length - 1];
93
88
 
94
- const summaryId = subtask.id[subtask.id.length - 1];
89
+ if (subtask.options.has("testSummaryIndex")) {
90
+ args.testSummaryIndex = failureIndex;
95
91
 
96
92
  testSummaries[summaryId] = await subtask.run(args);
97
93
  failureIndex += testSummaries[summaryId].failed ?? 0;
94
+ } else if (summaryId === "mocha") {
95
+ // mocha doesn't use the testSummaryIndex, but it does return failure & success counts
96
+ testSummaries[summaryId] = await subtask.run(args);
98
97
  } else {
99
98
  await subtask.run(args);
100
99
  }
101
100
  }
102
101
 
103
- if (!hasMocha) {
104
- const passed: Array<[string, number]> = [];
105
- const failed: Array<[string, number]> = [];
106
- const skipped: Array<[string, number]> = [];
107
- const todo: Array<[string, number]> = [];
108
- const outputLines: string[] = [];
102
+ const passed: Array<[string, number]> = [];
103
+ const failed: Array<[string, number]> = [];
104
+ const skipped: Array<[string, number]> = [];
105
+ const todo: Array<[string, number]> = [];
106
+ const outputLines: string[] = [];
109
107
 
110
- for (const [subtaskName, results] of Object.entries(testSummaries)) {
111
- if (results.passed > 0) {
112
- passed.push([subtaskName, results.passed]);
113
- }
108
+ for (const [subtaskName, results] of Object.entries(testSummaries)) {
109
+ if (results.passed !== undefined && results.passed > 0) {
110
+ passed.push([subtaskName, results.passed]);
111
+ }
114
112
 
115
- if (results.failed > 0) {
116
- failed.push([subtaskName, results.failed]);
117
- }
113
+ if (results.failed !== undefined && results.failed > 0) {
114
+ failed.push([subtaskName, results.failed]);
115
+ }
118
116
 
119
- if (results.skipped > 0) {
120
- skipped.push([subtaskName, results.skipped]);
121
- }
117
+ if (results.skipped !== undefined && results.skipped > 0) {
118
+ skipped.push([subtaskName, results.skipped]);
119
+ }
122
120
 
123
- if (results.todo > 0) {
124
- todo.push([subtaskName, results.todo]);
125
- }
121
+ if (results.todo !== undefined && results.todo > 0) {
122
+ todo.push([subtaskName, results.todo]);
123
+ }
126
124
 
127
- if (results.failureOutput !== "") {
128
- const output = results.failureOutput;
125
+ if (results.failureOutput !== undefined && results.failureOutput !== "") {
126
+ const output = results.failureOutput;
129
127
 
130
- if (subtaskName.includes("node")) {
131
- outputLines.push(`\n${output}\n`);
132
- } else {
133
- outputLines.push(output);
134
- }
128
+ if (subtaskName.includes("node")) {
129
+ outputLines.push(`\n${output}\n`);
130
+ } else {
131
+ outputLines.push(output);
135
132
  }
136
133
  }
134
+ }
137
135
 
138
- if (passed.length > 0) {
139
- logSummaryLine("passing", passed, chalk.green);
140
- }
141
-
142
- if (failed.length > 0) {
143
- logSummaryLine("failing", failed, chalk.red);
144
- }
136
+ if (passed.length > 0) {
137
+ logSummaryLine("passing", passed, chalk.green);
138
+ }
145
139
 
146
- if (skipped.length > 0) {
147
- logSummaryLine("skipped", skipped, chalk.cyan);
148
- }
140
+ if (failed.length > 0) {
141
+ logSummaryLine("failing", failed, chalk.red);
142
+ }
149
143
 
150
- if (todo.length > 0) {
151
- logSummaryLine("todo", todo, chalk.blue);
152
- }
144
+ if (skipped.length > 0) {
145
+ logSummaryLine("skipped", skipped, chalk.cyan);
146
+ }
153
147
 
154
- if (outputLines.length > 0) {
155
- console.log(
156
- outputLines
157
- .map((o) => {
158
- const nl = o.match(/\n+$/gm);
159
- if (nl !== null) {
160
- return o.replace(new RegExp(`${nl[0]}$`), "\n");
161
- }
162
- return o;
163
- })
164
- .join("\n"),
165
- );
166
- }
148
+ if (todo.length > 0) {
149
+ logSummaryLine("todo", todo, chalk.blue);
150
+ }
167
151
 
168
- console.log();
152
+ if (outputLines.length > 0) {
153
+ console.log(
154
+ outputLines
155
+ .map((o) => {
156
+ const nl = o.match(/\n+$/gm);
157
+ if (nl !== null) {
158
+ return o.replace(new RegExp(`${nl[0]}$`), "\n");
159
+ }
160
+ return o;
161
+ })
162
+ .join("\n"),
163
+ );
169
164
  }
170
165
 
166
+ console.log();
167
+
171
168
  if (hre.globalOptions.coverage === true) {
172
169
  assertHardhatInvariant(
173
170
  hre instanceof HardhatRuntimeEnvironmentImplementation,
@@ -5,7 +5,7 @@
5
5
  "description": "A TypeScript Hardhat project using Node Test Runner and Viem",
6
6
  "type": "module",
7
7
  "devDependencies": {
8
- "hardhat": "workspace:^3.1.2",
8
+ "hardhat": "workspace:^3.1.4",
9
9
  "@nomicfoundation/hardhat-toolbox-viem": "workspace:^5.0.1",
10
10
  "@nomicfoundation/hardhat-ignition": "workspace:^3.0.6",
11
11
  "@types/node": "^22.8.5",
@@ -5,9 +5,9 @@
5
5
  "description": "A TypeScript Hardhat project using Mocha and Ethers.js",
6
6
  "type": "module",
7
7
  "devDependencies": {
8
- "hardhat": "workspace:^3.1.2",
8
+ "hardhat": "workspace:^3.1.4",
9
9
  "@nomicfoundation/hardhat-toolbox-mocha-ethers": "workspace:^3.0.2",
10
- "@nomicfoundation/hardhat-ethers": "workspace:^4.0.2",
10
+ "@nomicfoundation/hardhat-ethers": "workspace:^4.0.4",
11
11
  "@nomicfoundation/hardhat-ignition": "workspace:^3.0.6",
12
12
  "@types/chai": "^4.2.0",
13
13
  "@types/chai-as-promised": "^8.0.1",
@@ -20,12 +20,12 @@
20
20
  "typescript": "~5.8.0"
21
21
  },
22
22
  "peerDependencies": {
23
- "@nomicfoundation/hardhat-ethers": "workspace:^4.0.2",
23
+ "@nomicfoundation/hardhat-ethers": "workspace:^4.0.4",
24
24
  "@nomicfoundation/hardhat-ethers-chai-matchers": "workspace:^3.0.2",
25
25
  "@nomicfoundation/hardhat-ignition": "workspace:^3.0.6",
26
26
  "@nomicfoundation/hardhat-ignition-ethers": "workspace:^3.0.6",
27
27
  "@nomicfoundation/hardhat-keystore": "workspace:^3.0.2",
28
- "@nomicfoundation/hardhat-mocha": "workspace:^3.0.8",
28
+ "@nomicfoundation/hardhat-mocha": "workspace:^3.0.9",
29
29
  "@nomicfoundation/hardhat-network-helpers": "workspace:^3.0.3",
30
30
  "@nomicfoundation/hardhat-typechain": "workspace:^3.0.0",
31
31
  "@nomicfoundation/hardhat-verify": "workspace:^3.0.8",
@@ -5,7 +5,7 @@
5
5
  "description": "A minimal Hardhat project",
6
6
  "type": "module",
7
7
  "devDependencies": {
8
- "hardhat": "workspace:^3.1.2",
8
+ "hardhat": "workspace:^3.1.4",
9
9
  "@types/node": "^22.8.5",
10
10
  "typescript": "~5.8.0"
11
11
  }