@@ -71,11 +71,7 @@ describe("Hardhat Node plugin", () => {
7171 tasks : [ buildOverride ] ,
7272 } ) ;
7373
74- // The task may throw because of the ESM re-run guard, but we only
75- // care about the build invocation args captured before that point.
76- try {
77- await hre . tasks . getTask ( [ "test" , "nodejs" ] ) . run ( { } ) ;
78- } catch { }
74+ await hre . tasks . getTask ( [ "test" , "nodejs" ] ) . run ( { } ) ;
7975
8076 assert . equal ( buildArgs . length , 1 ) ;
8177 assert . equal ( buildArgs [ 0 ] . noTests , false ) ;
@@ -92,24 +88,36 @@ describe("Hardhat Node plugin", () => {
9288 tasks : [ buildOverride ] ,
9389 } ) ;
9490
95- try {
96- await hre . tasks . getTask ( [ "test" , "nodejs" ] ) . run ( { } ) ;
97- } catch { }
91+ await hre . tasks . getTask ( [ "test" , "nodejs" ] ) . run ( { } ) ;
9892
9993 assert . equal ( buildArgs . length , 1 ) ;
10094 assert . equal ( buildArgs [ 0 ] . noTests , true ) ;
10195 } ) ;
10296
103- it ( "should skip compilation when noCompile is true regardless of splitTestsCompilation" , async ( ) => {
97+ it ( "should skip compilation when noCompile is true without splitTestsCompilation" , async ( ) => {
10498 const { buildArgs, buildOverride } = buildArgCaptor ( ) ;
10599 const hre = await createHardhatRuntimeEnvironment ( {
106100 plugins : [ HardhatNodeTestRunnerPlugin ] ,
107101 tasks : [ buildOverride ] ,
108102 } ) ;
109103
110- try {
111- await hre . tasks . getTask ( [ "test" , "nodejs" ] ) . run ( { noCompile : true } ) ;
112- } catch { }
104+ await hre . tasks . getTask ( [ "test" , "nodejs" ] ) . run ( { noCompile : true } ) ;
105+
106+ assert . equal ( buildArgs . length , 0 ) ;
107+ } ) ;
108+
109+ it ( "should skip compilation when noCompile is true with splitTestsCompilation" , async ( ) => {
110+ const { buildArgs, buildOverride } = buildArgCaptor ( ) ;
111+ const hre = await createHardhatRuntimeEnvironment ( {
112+ solidity : {
113+ version : "0.8.28" ,
114+ splitTestsCompilation : true ,
115+ } ,
116+ plugins : [ HardhatNodeTestRunnerPlugin ] ,
117+ tasks : [ buildOverride ] ,
118+ } ) ;
119+
120+ await hre . tasks . getTask ( [ "test" , "nodejs" ] ) . run ( { noCompile : true } ) ;
113121
114122 assert . equal ( buildArgs . length , 0 ) ;
115123 } ) ;
0 commit comments