@@ -20,23 +20,23 @@ interface TaskRes {
20
20
describe ( "main" , function ( ) {
21
21
let hre : HardhatRuntimeEnvironment ;
22
22
23
- // TASKS and SUBTASKS are defined in the "before()" hooks before every "functionality test groups".
24
- let TASK : NewTaskDefinition ;
25
- let SUBTASK : NewTaskDefinition ;
23
+ // newTaskDefinitionS and newSubtaskDefinitionS are defined in the "before()" hooks before every "functionality test groups".
24
+ let newTaskDefinition : NewTaskDefinition ;
25
+ let newSubtaskDefinition : NewTaskDefinition ;
26
26
27
27
describe ( "parseTaskAndArguments" , function ( ) {
28
28
describe ( "only task and subtask" , function ( ) {
29
29
before ( async function ( ) {
30
- TASK = task ( [ "task" ] )
30
+ newTaskDefinition = task ( [ "task" ] )
31
31
. setAction ( ( ) => { } )
32
32
. build ( ) ;
33
33
34
- SUBTASK = task ( [ "task" , "subtask" ] )
34
+ newSubtaskDefinition = task ( [ "task" , "subtask" ] )
35
35
. setAction ( ( ) => { } )
36
36
. build ( ) ;
37
37
38
38
hre = await createHardhatRuntimeEnvironment ( {
39
- tasks : [ TASK , SUBTASK ] ,
39
+ tasks : [ newTaskDefinition , newSubtaskDefinition ] ,
40
40
} ) ;
41
41
} ) ;
42
42
@@ -52,15 +52,15 @@ describe("main", function () {
52
52
hre ,
53
53
) as TaskRes ;
54
54
55
- assert . equal ( res . task . id , SUBTASK . id ) ;
55
+ assert . equal ( res . task . id , newSubtaskDefinition . id ) ;
56
56
assert . deepEqual ( usedCliArguments , [ true , true , true , true ] ) ;
57
57
assert . deepEqual ( res . taskArguments , { } ) ;
58
58
} ) ;
59
59
} ) ;
60
60
61
61
describe ( "task and subtask with named parameters" , function ( ) {
62
62
before ( async function ( ) {
63
- TASK = task ( [ "task" ] )
63
+ newTaskDefinition = task ( [ "task" ] )
64
64
. addNamedParameter ( { name : "param" } )
65
65
. addNamedParameter ( {
66
66
name : "flag" ,
@@ -72,13 +72,13 @@ describe("main", function () {
72
72
. setAction ( ( ) => { } )
73
73
. build ( ) ;
74
74
75
- SUBTASK = task ( [ "task" , "subtask" ] )
75
+ newSubtaskDefinition = task ( [ "task" , "subtask" ] )
76
76
. addNamedParameter ( { name : "param" } )
77
77
. setAction ( ( ) => { } )
78
78
. build ( ) ;
79
79
80
80
hre = await createHardhatRuntimeEnvironment ( {
81
- tasks : [ TASK , SUBTASK ] ,
81
+ tasks : [ newTaskDefinition , newSubtaskDefinition ] ,
82
82
} ) ;
83
83
} ) ;
84
84
@@ -94,7 +94,7 @@ describe("main", function () {
94
94
hre ,
95
95
) as TaskRes ;
96
96
97
- assert . equal ( res . task . id , TASK . id ) ;
97
+ assert . equal ( res . task . id , newTaskDefinition . id ) ;
98
98
assert . deepEqual ( usedCliArguments , [ true , true , true ] ) ;
99
99
assert . deepEqual ( res . taskArguments , {
100
100
param : "<paramValue>" ,
@@ -113,7 +113,7 @@ describe("main", function () {
113
113
hre ,
114
114
) as TaskRes ;
115
115
116
- assert . equal ( res . task . id , SUBTASK . id ) ;
116
+ assert . equal ( res . task . id , newSubtaskDefinition . id ) ;
117
117
assert . deepEqual ( usedCliArguments , [ true , true , true , true ] ) ;
118
118
assert . deepEqual ( res . taskArguments , {
119
119
param : "<paramValue>" ,
@@ -132,7 +132,7 @@ describe("main", function () {
132
132
hre ,
133
133
) as TaskRes ;
134
134
135
- assert . equal ( res . task . id , TASK . id ) ;
135
+ assert . equal ( res . task . id , newTaskDefinition . id ) ;
136
136
assert . deepEqual ( usedCliArguments , [ true , true ] ) ;
137
137
assert . deepEqual ( res . taskArguments , { flag : true } ) ;
138
138
} ) ;
@@ -149,7 +149,7 @@ describe("main", function () {
149
149
hre ,
150
150
) as TaskRes ;
151
151
152
- assert . equal ( res . task . id , TASK . id ) ;
152
+ assert . equal ( res . task . id , newTaskDefinition . id ) ;
153
153
assert . deepEqual ( usedCliArguments , [ true , true , true ] ) ;
154
154
assert . deepEqual ( res . taskArguments , { flag : false } ) ;
155
155
} ) ;
@@ -167,7 +167,7 @@ describe("main", function () {
167
167
hre ,
168
168
) as TaskRes ;
169
169
170
- assert . equal ( res . task . id , TASK . id ) ;
170
+ assert . equal ( res . task . id , newTaskDefinition . id ) ;
171
171
assert . deepEqual ( usedCliArguments , [ true , true , true ] ) ;
172
172
assert . deepEqual ( res . taskArguments , { optionFlag : "<value>" } ) ;
173
173
} ) ;
@@ -226,7 +226,7 @@ describe("main", function () {
226
226
227
227
describe ( "task and subtask with positional parameters" , function ( ) {
228
228
before ( async function ( ) {
229
- TASK = task ( [ "task" ] )
229
+ newTaskDefinition = task ( [ "task" ] )
230
230
. addPositionalParameter ( { name : "param" } )
231
231
. addPositionalParameter ( {
232
232
name : "param2" ,
@@ -235,7 +235,7 @@ describe("main", function () {
235
235
. setAction ( ( ) => { } )
236
236
. build ( ) ;
237
237
238
- SUBTASK = task ( [ "task" , "subtask" ] )
238
+ newSubtaskDefinition = task ( [ "task" , "subtask" ] )
239
239
. addPositionalParameter ( { name : "param" } )
240
240
. addPositionalParameter ( {
241
241
name : "param2" ,
@@ -245,7 +245,7 @@ describe("main", function () {
245
245
. build ( ) ;
246
246
247
247
hre = await createHardhatRuntimeEnvironment ( {
248
- tasks : [ TASK , SUBTASK ] ,
248
+ tasks : [ newTaskDefinition , newSubtaskDefinition ] ,
249
249
} ) ;
250
250
} ) ;
251
251
@@ -261,7 +261,7 @@ describe("main", function () {
261
261
hre ,
262
262
) as TaskRes ;
263
263
264
- assert . equal ( res . task . id , TASK . id ) ;
264
+ assert . equal ( res . task . id , newTaskDefinition . id ) ;
265
265
assert . deepEqual ( usedCliArguments , [ true , true ] ) ;
266
266
assert . deepEqual ( res . taskArguments , {
267
267
param : "<paramValue>" ,
@@ -281,7 +281,7 @@ describe("main", function () {
281
281
hre ,
282
282
) as TaskRes ;
283
283
284
- assert . equal ( res . task . id , TASK . id ) ;
284
+ assert . equal ( res . task . id , newTaskDefinition . id ) ;
285
285
assert . deepEqual ( usedCliArguments , [ true , true , true ] ) ;
286
286
assert . deepEqual ( res . taskArguments , {
287
287
param : "subtask" ,
@@ -301,7 +301,7 @@ describe("main", function () {
301
301
hre ,
302
302
) as TaskRes ;
303
303
304
- assert . equal ( res . task . id , TASK . id ) ;
304
+ assert . equal ( res . task . id , newTaskDefinition . id ) ;
305
305
assert . deepEqual ( usedCliArguments , [ true , true , true ] ) ;
306
306
assert . deepEqual ( res . taskArguments , {
307
307
param : "foo" ,
@@ -321,7 +321,7 @@ describe("main", function () {
321
321
hre ,
322
322
) as TaskRes ;
323
323
324
- assert . equal ( res . task . id , SUBTASK . id ) ;
324
+ assert . equal ( res . task . id , newSubtaskDefinition . id ) ;
325
325
assert . deepEqual ( usedCliArguments , [ true , true , true ] ) ;
326
326
assert . deepEqual ( res . taskArguments , {
327
327
param : "<paramValue>" ,
@@ -340,7 +340,7 @@ describe("main", function () {
340
340
hre ,
341
341
) as TaskRes ;
342
342
343
- assert . equal ( res . task . id , SUBTASK . id ) ;
343
+ assert . equal ( res . task . id , newSubtaskDefinition . id ) ;
344
344
assert . deepEqual ( usedCliArguments , [ true , true , true , true ] ) ;
345
345
assert . deepEqual ( res . taskArguments , {
346
346
param : "<paramValue>" ,
@@ -351,13 +351,13 @@ describe("main", function () {
351
351
352
352
describe ( "task and subtask with variadic parameters" , function ( ) {
353
353
before ( async function ( ) {
354
- TASK = task ( [ "task" ] )
354
+ newTaskDefinition = task ( [ "task" ] )
355
355
. addVariadicParameter ( { name : "param" } )
356
356
. setAction ( ( ) => { } )
357
357
. build ( ) ;
358
358
359
359
hre = await createHardhatRuntimeEnvironment ( {
360
- tasks : [ TASK , SUBTASK ] ,
360
+ tasks : [ newTaskDefinition , newSubtaskDefinition ] ,
361
361
} ) ;
362
362
} ) ;
363
363
@@ -373,7 +373,7 @@ describe("main", function () {
373
373
hre ,
374
374
) as TaskRes ;
375
375
376
- assert . equal ( res . task . id , TASK . id ) ;
376
+ assert . equal ( res . task . id , newTaskDefinition . id ) ;
377
377
assert . deepEqual ( usedCliArguments , [ true , true , true , true ] ) ;
378
378
assert . deepEqual ( res . taskArguments , {
379
379
param : [ "<val1>" , "<val2>" , "<val3>" ] ,
@@ -392,7 +392,7 @@ describe("main", function () {
392
392
hre ,
393
393
) as TaskRes ;
394
394
395
- assert . equal ( res . task . id , TASK . id ) ;
395
+ assert . equal ( res . task . id , newTaskDefinition . id ) ;
396
396
assert . deepEqual ( usedCliArguments , [ true ] ) ;
397
397
assert . deepEqual ( res . taskArguments , { } ) ;
398
398
} ) ;
@@ -401,7 +401,7 @@ describe("main", function () {
401
401
describe ( "formatting of parameters types" , function ( ) {
402
402
describe ( "named parameters" , function ( ) {
403
403
before ( async function ( ) {
404
- TASK = task ( [ "task" ] )
404
+ newTaskDefinition = task ( [ "task" ] )
405
405
. addNamedParameter ( { name : "param" , type : ParameterType . BIGINT } )
406
406
. addNamedParameter ( { name : "param2" , type : ParameterType . BOOLEAN } )
407
407
. addNamedParameter ( { name : "param3" , type : ParameterType . FILE } )
@@ -412,7 +412,7 @@ describe("main", function () {
412
412
. build ( ) ;
413
413
414
414
hre = await createHardhatRuntimeEnvironment ( {
415
- tasks : [ TASK ] ,
415
+ tasks : [ newTaskDefinition ] ,
416
416
} ) ;
417
417
} ) ;
418
418
@@ -452,7 +452,7 @@ describe("main", function () {
452
452
453
453
describe ( "positional parameters" , function ( ) {
454
454
before ( async function ( ) {
455
- TASK = task ( [ "task" ] )
455
+ newTaskDefinition = task ( [ "task" ] )
456
456
. addPositionalParameter ( {
457
457
name : "param" ,
458
458
type : ParameterType . BIGINT ,
@@ -478,7 +478,7 @@ describe("main", function () {
478
478
. build ( ) ;
479
479
480
480
hre = await createHardhatRuntimeEnvironment ( {
481
- tasks : [ TASK ] ,
481
+ tasks : [ newTaskDefinition ] ,
482
482
} ) ;
483
483
} ) ;
484
484
@@ -533,7 +533,7 @@ describe("main", function () {
533
533
it ( "should correctly format the parameters accordingly to their types" , async function ( ) {
534
534
// Variadic parameters can only be of a single type at a time, so loop through all the types
535
535
for ( let i = 0 ; i < paramTypes . length ; i ++ ) {
536
- TASK = task ( [ "task" ] )
536
+ newTaskDefinition = task ( [ "task" ] )
537
537
. addVariadicParameter ( {
538
538
name : "param" ,
539
539
type : paramTypes [ i ] ,
@@ -542,7 +542,7 @@ describe("main", function () {
542
542
. build ( ) ;
543
543
544
544
hre = await createHardhatRuntimeEnvironment ( {
545
- tasks : [ TASK ] ,
545
+ tasks : [ newTaskDefinition ] ,
546
546
} ) ;
547
547
548
548
const command = `npx hardhat task ${ paramValues [ i ] } ` ;
@@ -563,7 +563,7 @@ describe("main", function () {
563
563
564
564
describe ( "combine all the parameters' types" , function ( ) {
565
565
before ( async function ( ) {
566
- TASK = task ( [ "task" ] )
566
+ newTaskDefinition = task ( [ "task" ] )
567
567
. addNamedParameter ( { name : "param" } )
568
568
. addPositionalParameter ( { name : "posParam" } )
569
569
. addPositionalParameter ( {
@@ -574,12 +574,12 @@ describe("main", function () {
574
574
. setAction ( ( ) => { } )
575
575
. build ( ) ;
576
576
577
- SUBTASK = task ( [ "task" , "subtask" ] )
577
+ newSubtaskDefinition = task ( [ "task" , "subtask" ] )
578
578
. setAction ( ( ) => { } )
579
579
. build ( ) ;
580
580
581
581
hre = await createHardhatRuntimeEnvironment ( {
582
- tasks : [ TASK , SUBTASK ] ,
582
+ tasks : [ newTaskDefinition , newSubtaskDefinition ] ,
583
583
} ) ;
584
584
} ) ;
585
585
@@ -607,7 +607,7 @@ describe("main", function () {
607
607
hre ,
608
608
) as TaskRes ;
609
609
610
- assert . equal ( res . task . id , TASK . id ) ;
610
+ assert . equal ( res . task . id , newTaskDefinition . id ) ;
611
611
assert . deepEqual ( usedCliArguments , [
612
612
true ,
613
613
true ,
0 commit comments