This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ class CLIDebugHook {
18
18
// turn off timeouts for the current runnable
19
19
// HACK we don't turn it back on because it doesn't work...
20
20
// tests that take a long time _after_ debug break just won't timeout
21
- this . disableTimeout ( ) ;
21
+ await this . disableTimeout ( ) ;
22
22
23
23
const { txHash, result, method } = await this . invoke ( operation ) ;
24
24
debug ( "txHash: %o" , txHash ) ;
@@ -38,8 +38,8 @@ class CLIDebugHook {
38
38
39
39
async start ( ) { }
40
40
41
- disableTimeout ( ) {
42
- this . runner . currentRunnable . timeout ( 0 ) ;
41
+ async disableTimeout ( ) {
42
+ ( await this . runner ) . currentRunnable . timeout ( 0 ) ;
43
43
}
44
44
45
45
async invoke ( operation ) {
Original file line number Diff line number Diff line change @@ -90,6 +90,17 @@ export const Test = {
90
90
91
91
const mocha = this . createMocha ( config ) ;
92
92
93
+ // set up a promise on this instance to resolve to
94
+ // Mocha's "runner" returned by `mocha.run(...)`.
95
+ //
96
+ // do this upfront so that the promise is available
97
+ // immediately, even though mocha.run happens at the very
98
+ // end of this setup.
99
+ let setMochaRunner : ( mochaRunner : any ) => void ;
100
+ this . mochaRunner = new Promise ( resolve => {
101
+ setMochaRunner = resolve ;
102
+ } ) ;
103
+
93
104
const jsTests = config . test_files . filter ( ( file : string ) => {
94
105
return path . extname ( file ) !== ".sol" ;
95
106
} ) ;
@@ -177,10 +188,14 @@ export const Test = {
177
188
} ) ;
178
189
179
190
return new Promise ( resolve => {
180
- this . mochaRunner = mocha . run ( ( failures : number ) => {
191
+ const mochaRunner = mocha . run ( ( failures : number ) => {
181
192
config . logger . warn = warn ;
182
193
resolve ( failures ) ;
183
194
} ) ;
195
+
196
+ // finish setting up the mocha runner so that the
197
+ // previously-made promise resolves.
198
+ setMochaRunner ( mochaRunner ) ;
184
199
} ) ;
185
200
} ,
186
201
You can’t perform that action at this time.
0 commit comments