Skip to content

Commit 2c24a0a

Browse files
committed
Test noCompile with and without splitTestsCompilation
1 parent 7cb2575 commit 2c24a0a

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

packages/hardhat-mocha/test/index.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from "@nomicfoundation/hardhat-test-utils";
1111
import { ensureError } from "@nomicfoundation/hardhat-utils/error";
1212
import { overrideTask } from "hardhat/config";
13+
import { createHardhatRuntimeEnvironment } from "hardhat/hre";
1314

1415
import HardhatMochaPlugin from "../src/index.js";
1516

@@ -117,9 +118,23 @@ describe("Hardhat Mocha plugin", () => {
117118
assert.equal(buildArgs[0].noTests, true);
118119
});
119120

120-
it("should skip compilation when noCompile is true regardless of splitTestsCompilation", async () => {
121-
const { createHardhatRuntimeEnvironment } = await import("hardhat/hre");
121+
it("should skip compilation when noCompile is true with splitTestsCompilation", async () => {
122+
const { buildArgs, buildOverride } = buildArgCaptor();
123+
const hre = await createHardhatRuntimeEnvironment({
124+
solidity: {
125+
version: "0.8.28",
126+
splitTestsCompilation: true,
127+
},
128+
plugins: [HardhatMochaPlugin],
129+
tasks: [buildOverride],
130+
});
131+
132+
await runMochaIgnoringEsmReRunErrors(hre, { noCompile: true });
133+
134+
assert.equal(buildArgs.length, 0);
135+
});
122136

137+
it("should skip compilation when noCompile is true without splitTestsCompilation", async () => {
123138
const { buildArgs, buildOverride } = buildArgCaptor();
124139
const hre = await createHardhatRuntimeEnvironment({
125140
plugins: [HardhatMochaPlugin],

0 commit comments

Comments
 (0)