@@ -6,7 +6,7 @@ import { before, describe, it } from "node:test";
6
6
import { createHardhatRuntimeEnvironment } from "@nomicfoundation/hardhat-core" ;
7
7
import { HardhatError } from "@nomicfoundation/hardhat-errors" ;
8
8
9
- import { runScriptWithHardhat } from "../../../../../src/internal/builtin-plugins/run/runScriptWithHardhat.js" ;
9
+ import runScriptWithHardhat from "../../../../../src/internal/builtin-plugins/run/runScriptWithHardhat.js" ;
10
10
import { useFixtureProject } from "../../../../helpers/project.js" ;
11
11
12
12
describe ( "runScriptWithHardhat" , function ( ) {
@@ -17,28 +17,28 @@ describe("runScriptWithHardhat", function () {
17
17
} ) ;
18
18
19
19
it ( "should throw if script is not a string" , async function ( ) {
20
- await assert . rejects ( async ( ) => {
21
- await runScriptWithHardhat ( { script : 123 , noCompile : false } , hre ) ;
22
- } , / A n i n t e r n a l i n v a r i a n t w a s v i o l a t e d : E x p e c t e d s c r i p t t o b e a s t r i n g / ) ;
20
+ await assert . rejects (
21
+ runScriptWithHardhat ( { script : 123 , noCompile : false } , hre ) ,
22
+ / A n i n t e r n a l i n v a r i a n t w a s v i o l a t e d : E x p e c t e d s c r i p t t o b e a s t r i n g / ,
23
+ ) ;
23
24
} ) ;
24
25
25
26
it ( "should throw if noCompile is not a boolean" , async function ( ) {
26
- await assert . rejects ( async ( ) => {
27
- await runScriptWithHardhat ( { script : "script.js" , noCompile : 123 } , hre ) ;
28
- } , / A n i n t e r n a l i n v a r i a n t w a s v i o l a t e d : E x p e c t e d n o C o m p i l e t o b e a b o o l e a n / ) ;
27
+ await assert . rejects (
28
+ runScriptWithHardhat ( { script : "script.js" , noCompile : 123 } , hre ) ,
29
+ / A n i n t e r n a l i n v a r i a n t w a s v i o l a t e d : E x p e c t e d n o C o m p i l e t o b e a b o o l e a n / ,
30
+ ) ;
29
31
} ) ;
30
32
31
33
describe ( "javascript" , function ( ) {
32
34
useFixtureProject ( "run-js-script" ) ;
33
35
34
36
it ( "should throw if script does not exist" , async function ( ) {
35
37
await assert . rejects (
36
- async ( ) => {
37
- await runScriptWithHardhat (
38
- { script : "./scripts/non-existent.js" , noCompile : false } ,
39
- hre ,
40
- ) ;
41
- } ,
38
+ runScriptWithHardhat (
39
+ { script : "./scripts/non-existent.js" , noCompile : false } ,
40
+ hre ,
41
+ ) ,
42
42
new HardhatError ( HardhatError . ERRORS . BUILTIN_TASKS . RUN_FILE_NOT_FOUND , {
43
43
script : "./scripts/non-existent.js" ,
44
44
} ) ,
@@ -54,12 +54,10 @@ describe("runScriptWithHardhat", function () {
54
54
55
55
it ( "should throw if the script throws" , async function ( ) {
56
56
await assert . rejects (
57
- async ( ) => {
58
- await runScriptWithHardhat (
59
- { script : "./scripts/throws.js" , noCompile : false } ,
60
- hre ,
61
- ) ;
62
- } ,
57
+ runScriptWithHardhat (
58
+ { script : "./scripts/throws.js" , noCompile : false } ,
59
+ hre ,
60
+ ) ,
63
61
new HardhatError ( HardhatError . ERRORS . BUILTIN_TASKS . RUN_SCRIPT_ERROR , {
64
62
script : "./scripts/throws.js" ,
65
63
error : "broken script" ,
@@ -73,12 +71,10 @@ describe("runScriptWithHardhat", function () {
73
71
74
72
it ( "should throw if script does not exist" , async function ( ) {
75
73
await assert . rejects (
76
- async ( ) => {
77
- await runScriptWithHardhat (
78
- { script : "./scripts/non-existent.ts" , noCompile : false } ,
79
- hre ,
80
- ) ;
81
- } ,
74
+ runScriptWithHardhat (
75
+ { script : "./scripts/non-existent.ts" , noCompile : false } ,
76
+ hre ,
77
+ ) ,
82
78
new HardhatError ( HardhatError . ERRORS . BUILTIN_TASKS . RUN_FILE_NOT_FOUND , {
83
79
script : "./scripts/non-existent.ts" ,
84
80
} ) ,
@@ -94,12 +90,10 @@ describe("runScriptWithHardhat", function () {
94
90
95
91
it ( "should throw if the script throws" , async function ( ) {
96
92
await assert . rejects (
97
- async ( ) => {
98
- await runScriptWithHardhat (
99
- { script : "./scripts/throws.ts" , noCompile : false } ,
100
- hre ,
101
- ) ;
102
- } ,
93
+ runScriptWithHardhat (
94
+ { script : "./scripts/throws.ts" , noCompile : false } ,
95
+ hre ,
96
+ ) ,
103
97
new HardhatError ( HardhatError . ERRORS . BUILTIN_TASKS . RUN_SCRIPT_ERROR , {
104
98
script : "./scripts/throws.ts" ,
105
99
error : "broken script" ,
0 commit comments