mirror of
https://github.com/luxfhe/hardhat-plugin.git
synced 2026-10-30 18:13:07 +00:00
23 lines
633 B
TypeScript
23 lines
633 B
TypeScript
import { resetHardhatContext } from "hardhat/plugins-testing";
|
|
import { HardhatRuntimeEnvironment } from "hardhat/types";
|
|
import path from "path";
|
|
|
|
declare module "mocha" {
|
|
interface Context {
|
|
hre: HardhatRuntimeEnvironment;
|
|
}
|
|
}
|
|
|
|
export function useEnvironment(fixtureProjectName: string) {
|
|
beforeEach("Loading hardhat environment", function () {
|
|
process.chdir(path.join(__dirname, "fixture-projects", fixtureProjectName));
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
this.hre = require("hardhat");
|
|
});
|
|
|
|
afterEach("Resetting hardhat", function () {
|
|
resetHardhatContext();
|
|
});
|
|
}
|