@@ -10,6 +10,7 @@ import {
1010} from "@nomicfoundation/hardhat-test-utils" ;
1111import { ensureError } from "@nomicfoundation/hardhat-utils/error" ;
1212import { overrideTask } from "hardhat/config" ;
13+ import { createHardhatRuntimeEnvironment } from "hardhat/hre" ;
1314
1415import 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