hardhat
Version:
Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
31 lines • 1.62 kB
JavaScript
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
import { HardhatRuntimeEnvironmentImplementation } from "../../core/hre.js";
/**
* NOTE: The following helpers interact with the global HRE instance only;
* This is OK because:
* - They are intended for the internal use only. They are exposed via the
* internal public API only.
* - We know the HRE has been initialized by the time they are used.
*/
export async function markTestRunStart(id) {
const { default: hre } = await import("../../../index.js");
if (hre.globalOptions.gasStats === true) {
assertHardhatInvariant(hre instanceof HardhatRuntimeEnvironmentImplementation, "Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation");
await hre._gasAnalytics.clearGasMeasurements(id);
}
}
export async function markTestWorkerDone(id) {
const { default: hre } = await import("../../../index.js");
if (hre.globalOptions.gasStats === true) {
assertHardhatInvariant(hre instanceof HardhatRuntimeEnvironmentImplementation, "Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation");
await hre._gasAnalytics.saveGasMeasurements(id);
}
}
export async function markTestRunDone(id) {
const { default: hre } = await import("../../../index.js");
if (hre.globalOptions.gasStats === true) {
assertHardhatInvariant(hre instanceof HardhatRuntimeEnvironmentImplementation, "Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation");
await hre._gasAnalytics.reportGasStats(id);
}
}
//# sourceMappingURL=helpers.js.map