diff --git a/jstests/libs/bulk_write_passthrough_runner.js b/jstests/libs/bulk_write_passthrough_runner.js index 611be53bafb..4062b8a5116 100644 --- a/jstests/libs/bulk_write_passthrough_runner.js +++ b/jstests/libs/bulk_write_passthrough_runner.js @@ -2,6 +2,11 @@ const testFile = TestData.jsTestFile; try { await import(testFile); + if (typeof globalThis.__mochalite_closer === "function") { + // force the running of mocha-style tests immediately, instead of + // at the close of the shell's scope (outside this runner file) + await globalThis.__mochalite_closer(); + } } finally { // Run a lightweight command to allow the override file to flush the remaining bulkWrite. // Ensure this command runs even if the test errors. diff --git a/jstests/libs/txns/txn_passthrough_runner.js b/jstests/libs/txns/txn_passthrough_runner.js index 4b2dc87681a..f3406d1eb8f 100644 --- a/jstests/libs/txns/txn_passthrough_runner.js +++ b/jstests/libs/txns/txn_passthrough_runner.js @@ -2,6 +2,11 @@ const testFile = TestData.multiStmtTxnTestFile; try { await import(testFile); + if (typeof globalThis.__mochalite_closer === "function") { + // force the running of mocha-style tests immediately, instead of + // at the close of the shell's scope (outside this runner file) + await globalThis.__mochalite_closer(); + } } finally { // Run a lightweight command to allow the override file to commit the last command. // Ensure this command runs even if the test errors.