hardhat 3.4.1 → 3.4.2
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 +21 -0
- package/dist/src/cli.js +5 -5
- package/dist/src/cli.js.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js +10 -3
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.js +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.d.ts +7 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js +24 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.d.ts +4 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.js +27 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.js.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/clean.js +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/clean.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 +18 -15
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js +10 -4
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.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 +18 -14
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +2 -7
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts +14 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js +40 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts +1 -12
- 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 +0 -39
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.js +2 -5
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/helpers.js +1 -1
- package/dist/src/internal/builtin-plugins/node/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +50 -20
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js +6 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
- package/dist/src/internal/cli/init/init.d.ts.map +1 -1
- package/dist/src/internal/cli/init/init.js +17 -8
- package/dist/src/internal/cli/init/init.js.map +1 -1
- package/dist/src/internal/cli/init/template.d.ts.map +1 -1
- package/dist/src/internal/cli/init/template.js +5 -14
- package/dist/src/internal/cli/init/template.js.map +1 -1
- package/dist/src/internal/cli/node-version.d.ts +1 -1
- package/dist/src/internal/cli/node-version.d.ts.map +1 -1
- package/dist/src/internal/cli/node-version.js +16 -9
- package/dist/src/internal/cli/node-version.js.map +1 -1
- package/dist/src/internal/core/hook-manager.d.ts.map +1 -1
- package/dist/src/internal/core/hook-manager.js +194 -57
- package/dist/src/internal/core/hook-manager.js.map +1 -1
- package/dist/src/internal/core/hre.js +2 -2
- package/dist/src/internal/core/hre.js.map +1 -1
- package/dist/src/internal/core/lazy-user-interruptions.d.ts +11 -0
- package/dist/src/internal/core/lazy-user-interruptions.d.ts.map +1 -0
- package/dist/src/internal/core/lazy-user-interruptions.js +39 -0
- package/dist/src/internal/core/lazy-user-interruptions.js.map +1 -0
- package/package.json +2 -2
- package/src/cli.ts +5 -5
- package/src/internal/builtin-plugins/artifacts/artifact-manager.ts +12 -5
- package/src/internal/builtin-plugins/coverage/exports.ts +1 -1
- package/src/internal/builtin-plugins/coverage/helpers/accessors.ts +44 -0
- package/src/internal/builtin-plugins/coverage/helpers/compat.ts +37 -0
- package/src/internal/builtin-plugins/coverage/hook-handlers/clean.ts +1 -1
- package/src/internal/builtin-plugins/coverage/hook-handlers/hre.ts +26 -16
- package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +1 -1
- package/src/internal/builtin-plugins/coverage/hook-handlers/test.ts +1 -1
- package/src/internal/builtin-plugins/gas-analytics/helpers/accessors.ts +12 -5
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts +29 -17
- package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +2 -6
- package/src/internal/builtin-plugins/network-manager/config-resolution.ts +1 -1
- package/src/internal/builtin-plugins/network-manager/edr/edr-constants.ts +61 -0
- package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +0 -59
- package/src/internal/builtin-plugins/network-manager/edr/types/hardfork.ts +3 -9
- package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +1 -1
- package/src/internal/builtin-plugins/node/helpers.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +69 -43
- package/src/internal/builtin-plugins/solidity/hook-handlers/hre.ts +13 -4
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +1 -1
- package/src/internal/builtin-plugins/test/task-action.ts +1 -1
- package/src/internal/cli/init/init.ts +31 -13
- package/src/internal/cli/init/template.ts +22 -27
- package/src/internal/cli/node-version.ts +19 -11
- package/src/internal/core/hook-manager.ts +265 -101
- package/src/internal/core/hre.ts +2 -2
- package/src/internal/core/lazy-user-interruptions.ts +75 -0
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +2 -2
- package/templates/hardhat-3/02-mocha-ethers/package.json +2 -2
- package/templates/hardhat-3/03-minimal/package.json +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts +0 -15
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts.map +0 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.js +0 -35
- package/dist/src/internal/builtin-plugins/coverage/helpers.js.map +0 -1
- package/src/internal/builtin-plugins/coverage/helpers.ts +0 -63
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { UserInterruptionManagerImplementation as UserInterruptionManagerImplementationT } from "./user-interruptions.js";
|
|
2
|
+
import type { HookManager } from "../../types/hooks.js";
|
|
3
|
+
import type { UserInterruptionManager } from "../../types/user-interruptions.js";
|
|
4
|
+
|
|
5
|
+
let UserInterruptionManagerImplementation:
|
|
6
|
+
| typeof UserInterruptionManagerImplementationT
|
|
7
|
+
| undefined;
|
|
8
|
+
|
|
9
|
+
export class LazyUserInterruptionManager implements UserInterruptionManager {
|
|
10
|
+
readonly #hooks: HookManager;
|
|
11
|
+
|
|
12
|
+
#userInterruptionManager: UserInterruptionManagerImplementationT | undefined;
|
|
13
|
+
|
|
14
|
+
constructor(hooks: HookManager) {
|
|
15
|
+
this.#hooks = hooks;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public async displayMessage(
|
|
19
|
+
interruptor: string,
|
|
20
|
+
message: string,
|
|
21
|
+
): Promise<void> {
|
|
22
|
+
const userInterruptionManager = await this.#getUserInterruptionManager();
|
|
23
|
+
return await userInterruptionManager.displayMessage(interruptor, message);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public async requestInput(
|
|
27
|
+
interruptor: string,
|
|
28
|
+
inputDescription: string,
|
|
29
|
+
): Promise<string> {
|
|
30
|
+
const userInterruptionManager = await this.#getUserInterruptionManager();
|
|
31
|
+
return await userInterruptionManager.requestInput(
|
|
32
|
+
interruptor,
|
|
33
|
+
inputDescription,
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public async requestSecretInput(
|
|
38
|
+
interruptor: string,
|
|
39
|
+
inputDescription: string,
|
|
40
|
+
): Promise<string> {
|
|
41
|
+
const userInterruptionManager = await this.#getUserInterruptionManager();
|
|
42
|
+
return await userInterruptionManager.requestSecretInput(
|
|
43
|
+
interruptor,
|
|
44
|
+
inputDescription,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public async uninterrupted<ReturnT>(
|
|
49
|
+
f: () => ReturnT,
|
|
50
|
+
): Promise<Awaited<ReturnT>> {
|
|
51
|
+
const userInterruptionManager = await this.#getUserInterruptionManager();
|
|
52
|
+
return await userInterruptionManager.uninterrupted(f);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async #getUserInterruptionManager(): Promise<UserInterruptionManagerImplementationT> {
|
|
56
|
+
// Note: `await import` must run BEFORE the instance cache check so that
|
|
57
|
+
// concurrent callers share a single microtask-dedupe point — otherwise
|
|
58
|
+
// each suspended caller re-enters the branch and constructs its own
|
|
59
|
+
// impl, so callers end up holding different impl instances and state,
|
|
60
|
+
// which can cause concurrency issues.
|
|
61
|
+
if (UserInterruptionManagerImplementation === undefined) {
|
|
62
|
+
({ UserInterruptionManagerImplementation } = await import(
|
|
63
|
+
"./user-interruptions.js"
|
|
64
|
+
));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (this.#userInterruptionManager === undefined) {
|
|
68
|
+
this.#userInterruptionManager = new UserInterruptionManagerImplementation(
|
|
69
|
+
this.#hooks,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return this.#userInterruptionManager;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -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.4.
|
|
8
|
+
"hardhat": "workspace:^3.4.2",
|
|
9
9
|
"@nomicfoundation/hardhat-toolbox-viem": "workspace:^5.0.4",
|
|
10
10
|
"@nomicfoundation/hardhat-ignition": "workspace:^3.1.3",
|
|
11
11
|
"@types/node": "^22.8.5",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"viem": "^2.47.6"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@nomicfoundation/hardhat-ignition-viem": "workspace:^3.1.
|
|
17
|
+
"@nomicfoundation/hardhat-ignition-viem": "workspace:^3.1.4",
|
|
18
18
|
"@nomicfoundation/hardhat-keystore": "workspace:^3.0.7",
|
|
19
19
|
"@nomicfoundation/hardhat-network-helpers": "workspace:^3.0.6",
|
|
20
20
|
"@nomicfoundation/hardhat-node-test-runner": "workspace:^3.0.14",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "A TypeScript Hardhat project using Mocha and Ethers.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"hardhat": "workspace:^3.4.
|
|
8
|
+
"hardhat": "workspace:^3.4.2",
|
|
9
9
|
"@nomicfoundation/hardhat-toolbox-mocha-ethers": "workspace:^3.0.4",
|
|
10
10
|
"@nomicfoundation/hardhat-ethers": "workspace:^4.0.9",
|
|
11
11
|
"@nomicfoundation/hardhat-ignition": "workspace:^3.1.3",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@nomicfoundation/hardhat-ethers": "workspace:^4.0.9",
|
|
24
24
|
"@nomicfoundation/hardhat-ethers-chai-matchers": "workspace:^3.0.6",
|
|
25
25
|
"@nomicfoundation/hardhat-ignition": "workspace:^3.1.3",
|
|
26
|
-
"@nomicfoundation/hardhat-ignition-ethers": "workspace:^3.1.
|
|
26
|
+
"@nomicfoundation/hardhat-ignition-ethers": "workspace:^3.1.4",
|
|
27
27
|
"@nomicfoundation/hardhat-keystore": "workspace:^3.0.7",
|
|
28
28
|
"@nomicfoundation/hardhat-mocha": "workspace:^3.0.17",
|
|
29
29
|
"@nomicfoundation/hardhat-network-helpers": "workspace:^3.0.6",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CoverageManager } from "./types.js";
|
|
2
|
-
import type { HookContext } from "../../../types/hooks.js";
|
|
3
|
-
import type { HardhatRuntimeEnvironment } from "../../../types/hre.js";
|
|
4
|
-
export declare function getCoveragePath(rootPath: string): string;
|
|
5
|
-
export declare function getCoverageManager(hookContextOrHre: HookContext | HardhatRuntimeEnvironment): CoverageManager;
|
|
6
|
-
export declare function setCoverageManager(hre: HardhatRuntimeEnvironment, coverageManager: CoverageManager): void;
|
|
7
|
-
/**
|
|
8
|
-
* The following helpers are kept for backward compatibility with older versions
|
|
9
|
-
* of test runner plugins (hardhat-mocha, hardhat-node-test-runner) that import
|
|
10
|
-
* from "hardhat/internal/coverage".
|
|
11
|
-
*/
|
|
12
|
-
export declare function markTestRunStart(id: string): Promise<void>;
|
|
13
|
-
export declare function markTestWorkerDone(id: string): Promise<void>;
|
|
14
|
-
export declare function markTestRunDone(id: string): Promise<void>;
|
|
15
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/coverage/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAevE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,WAAW,GAAG,yBAAyB,GACxD,eAAe,CAOjB;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,yBAAyB,EAC9B,eAAe,EAAE,eAAe,GAC/B,IAAI,CAMN;AAED;;;;GAIG;AAEH,wBAAsB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhE;AAED,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGlE;AAED,wBAAsB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG/D"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
3
|
-
import { HardhatRuntimeEnvironmentImplementation } from "../../core/hre.js";
|
|
4
|
-
import { CoverageManagerImplementation } from "./coverage-manager.js";
|
|
5
|
-
import { testRunDone, testRunStart, testWorkerDone, } from "./hook-handlers/test.js";
|
|
6
|
-
export function getCoveragePath(rootPath) {
|
|
7
|
-
return path.join(rootPath, "coverage");
|
|
8
|
-
}
|
|
9
|
-
export function getCoverageManager(hookContextOrHre) {
|
|
10
|
-
assertHardhatInvariant("_coverage" in hookContextOrHre &&
|
|
11
|
-
hookContextOrHre._coverage instanceof CoverageManagerImplementation, "Expected _coverage to be an instance of CoverageManagerImplementation");
|
|
12
|
-
return hookContextOrHre._coverage;
|
|
13
|
-
}
|
|
14
|
-
export function setCoverageManager(hre, coverageManager) {
|
|
15
|
-
assertHardhatInvariant(hre instanceof HardhatRuntimeEnvironmentImplementation, "Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation");
|
|
16
|
-
hre._coverage = coverageManager;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* The following helpers are kept for backward compatibility with older versions
|
|
20
|
-
* of test runner plugins (hardhat-mocha, hardhat-node-test-runner) that import
|
|
21
|
-
* from "hardhat/internal/coverage".
|
|
22
|
-
*/
|
|
23
|
-
export async function markTestRunStart(id) {
|
|
24
|
-
const { default: hre } = await import("../../../index.js");
|
|
25
|
-
await testRunStart(hre, id);
|
|
26
|
-
}
|
|
27
|
-
export async function markTestWorkerDone(id) {
|
|
28
|
-
const { default: hre } = await import("../../../index.js");
|
|
29
|
-
await testWorkerDone(hre, id);
|
|
30
|
-
}
|
|
31
|
-
export async function markTestRunDone(id) {
|
|
32
|
-
const { default: hre } = await import("../../../index.js");
|
|
33
|
-
await testRunDone(hre, id);
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/coverage/helpers.ts"],"names":[],"mappings":"AAIA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,OAAO,EAAE,uCAAuC,EAAE,MAAM,mBAAmB,CAAC;AAE5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EACL,WAAW,EACX,YAAY,EACZ,cAAc,GACf,MAAM,yBAAyB,CAAC;AAEjC,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,gBAAyD;IAEzD,sBAAsB,CACpB,WAAW,IAAI,gBAAgB;QAC7B,gBAAgB,CAAC,SAAS,YAAY,6BAA6B,EACrE,uEAAuE,CACxE,CAAC;IACF,OAAO,gBAAgB,CAAC,SAAS,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,GAA8B,EAC9B,eAAgC;IAEhC,sBAAsB,CACpB,GAAG,YAAY,uCAAuC,EACtD,2EAA2E,CAC5E,CAAC;IACF,GAAG,CAAC,SAAS,GAAG,eAAe,CAAC;AAClC,CAAC;AAED;;;;GAIG;AAEH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EAAU;IAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC3D,MAAM,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EAAU;IACjD,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC3D,MAAM,cAAc,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EAAU;IAC9C,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC3D,MAAM,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { CoverageManager } from "./types.js";
|
|
2
|
-
import type { HookContext } from "../../../types/hooks.js";
|
|
3
|
-
import type { HardhatRuntimeEnvironment } from "../../../types/hre.js";
|
|
4
|
-
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
|
|
7
|
-
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
8
|
-
|
|
9
|
-
import { HardhatRuntimeEnvironmentImplementation } from "../../core/hre.js";
|
|
10
|
-
|
|
11
|
-
import { CoverageManagerImplementation } from "./coverage-manager.js";
|
|
12
|
-
import {
|
|
13
|
-
testRunDone,
|
|
14
|
-
testRunStart,
|
|
15
|
-
testWorkerDone,
|
|
16
|
-
} from "./hook-handlers/test.js";
|
|
17
|
-
|
|
18
|
-
export function getCoveragePath(rootPath: string): string {
|
|
19
|
-
return path.join(rootPath, "coverage");
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function getCoverageManager(
|
|
23
|
-
hookContextOrHre: HookContext | HardhatRuntimeEnvironment,
|
|
24
|
-
): CoverageManager {
|
|
25
|
-
assertHardhatInvariant(
|
|
26
|
-
"_coverage" in hookContextOrHre &&
|
|
27
|
-
hookContextOrHre._coverage instanceof CoverageManagerImplementation,
|
|
28
|
-
"Expected _coverage to be an instance of CoverageManagerImplementation",
|
|
29
|
-
);
|
|
30
|
-
return hookContextOrHre._coverage;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function setCoverageManager(
|
|
34
|
-
hre: HardhatRuntimeEnvironment,
|
|
35
|
-
coverageManager: CoverageManager,
|
|
36
|
-
): void {
|
|
37
|
-
assertHardhatInvariant(
|
|
38
|
-
hre instanceof HardhatRuntimeEnvironmentImplementation,
|
|
39
|
-
"Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation",
|
|
40
|
-
);
|
|
41
|
-
hre._coverage = coverageManager;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* The following helpers are kept for backward compatibility with older versions
|
|
46
|
-
* of test runner plugins (hardhat-mocha, hardhat-node-test-runner) that import
|
|
47
|
-
* from "hardhat/internal/coverage".
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
export async function markTestRunStart(id: string): Promise<void> {
|
|
51
|
-
const { default: hre } = await import("../../../index.js");
|
|
52
|
-
await testRunStart(hre, id);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export async function markTestWorkerDone(id: string): Promise<void> {
|
|
56
|
-
const { default: hre } = await import("../../../index.js");
|
|
57
|
-
await testWorkerDone(hre, id);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export async function markTestRunDone(id: string): Promise<void> {
|
|
61
|
-
const { default: hre } = await import("../../../index.js");
|
|
62
|
-
await testRunDone(hre, id);
|
|
63
|
-
}
|