File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -256,12 +256,16 @@ class NodeTestHelper extends EventEmitter {
256256 Object . defineProperty ( red , prop , propDescriptor ) ;
257257 } ) ;
258258 }
259+ const initPromises = [ ]
259260
260261 let preloadedCoreModules = new Set ( ) ;
261262 testFlow . forEach ( n => {
262263 if ( this . _nodeModules . hasOwnProperty ( n . type ) ) {
263264 // Go find the 'real' core node module and load it...
264- this . _nodeModules [ n . type ] ( red ) ;
265+ const result = this . _nodeModules [ n . type ] ( red ) ;
266+ if ( result ?. then ) {
267+ initPromises . push ( result )
268+ }
265269 preloadedCoreModules . add ( this . _nodeModules [ n . type ] ) ;
266270 }
267271 } )
@@ -271,12 +275,17 @@ class NodeTestHelper extends EventEmitter {
271275 }
272276 testNode . forEach ( fn => {
273277 if ( ! preloadedCoreModules . has ( fn ) ) {
274- fn ( red ) ;
278+ const result = fn ( red ) ;
279+ if ( result ?. then ) {
280+ initPromises . push ( result )
281+ }
275282 }
276283 } ) ;
277284
278- return redNodes . loadFlows ( )
279- . then ( redNodes . startFlows ) . then ( ( ) => {
285+ return Promise . all ( initPromises )
286+ . then ( redNodes . loadFlows )
287+ . then ( redNodes . startFlows )
288+ . then ( ( ) => {
280289 should . deepEqual ( testFlow , redNodes . getFlows ( ) . flows ) ;
281290 if ( cb ) cb ( ) ;
282291 } ) ;
You can’t perform that action at this time.
0 commit comments