UNPKG

hardhat

Version:

Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.

35 lines 1.67 kB
import path from "node:path"; import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors"; import { HardhatRuntimeEnvironmentImplementation } from "../../core/hre.js"; import { CoverageManagerImplementation } from "./coverage-manager.js"; import { testRunDone, testRunStart, testWorkerDone, } from "./hook-handlers/test.js"; export function getCoveragePath(rootPath) { return path.join(rootPath, "coverage"); } export function getCoverageManager(hookContextOrHre) { assertHardhatInvariant("_coverage" in hookContextOrHre && hookContextOrHre._coverage instanceof CoverageManagerImplementation, "Expected _coverage to be an instance of CoverageManagerImplementation"); return hookContextOrHre._coverage; } export function setCoverageManager(hre, coverageManager) { assertHardhatInvariant(hre instanceof HardhatRuntimeEnvironmentImplementation, "Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation"); hre._coverage = coverageManager; } /** * The following helpers are kept for backward compatibility with older versions * of test runner plugins (hardhat-mocha, hardhat-node-test-runner) that import * from "hardhat/internal/coverage". */ export async function markTestRunStart(id) { const { default: hre } = await import("../../../index.js"); await testRunStart(hre, id); } export async function markTestWorkerDone(id) { const { default: hre } = await import("../../../index.js"); await testWorkerDone(hre, id); } export async function markTestRunDone(id) { const { default: hre } = await import("../../../index.js"); await testRunDone(hre, id); } //# sourceMappingURL=helpers.js.map