diff --git a/src/script/runScript.ts b/src/script/runScript.ts index 1965768..e6be779 100644 --- a/src/script/runScript.ts +++ b/src/script/runScript.ts @@ -1,4 +1,4 @@ -import { setGlobalStringifyFunction } from '@naturalcycles/js-lib' +import { pDelay, setGlobalStringifyFunction } from '@naturalcycles/js-lib' import type { CommonLogger } from '@naturalcycles/js-lib' import { inspectStringifyFn } from '../string/inspect' @@ -60,6 +60,8 @@ export function runScript(fn: (...args: any[]) => any, opt: RunScriptOptions = { try { await fn() + await pDelay() // to ensure all async operations are completed + if (DEBUG_RUN_SCRIPT) logger.log(`runScript promise resolved`) if (!noExit) {