diff options
author | Matt Mastracci <matthew@mastracci.com> | 2024-03-01 14:26:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-01 21:26:57 +0000 |
commit | 2e4a1fc3e89d00e060ca9d747b6887dae215f0eb (patch) | |
tree | 95b22b268959651f004c58ffdbe24e82ff58df15 /cli/tools | |
parent | 22a4205a68672764dda5d66f5c9595d1fb538df4 (diff) |
fix(cli): force flush output after test unloads (#22660)
Fixes flake in load_unload test
Diffstat (limited to 'cli/tools')
-rw-r--r-- | cli/tools/test/mod.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cli/tools/test/mod.rs b/cli/tools/test/mod.rs index 0f10188bc..6b592f95e 100644 --- a/cli/tools/test/mod.rs +++ b/cli/tools/test/mod.rs @@ -391,7 +391,7 @@ pub enum TestEvent { StepRegister(TestStepDescription), StepWait(usize), StepResult(usize, TestStepResult, u64), - /// Indicates that this worker has completed. + /// Indicates that this worker has completed running tests. Completed, /// Indicates that the user has cancelled the test run with Ctrl+C and /// the run should be aborted. @@ -513,7 +513,7 @@ pub async fn test_specifier( worker_factory, permissions, specifier.clone(), - &worker_sender.sender, + &mut worker_sender.sender, StdioPipe::file(worker_sender.stdout), StdioPipe::file(worker_sender.stderr), fail_fast_tracker, @@ -543,7 +543,7 @@ async fn test_specifier_inner( worker_factory: Arc<CliMainWorkerFactory>, permissions: Permissions, specifier: ModuleSpecifier, - sender: &TestEventSender, + sender: &mut TestEventSender, stdout: StdioPipe, stderr: StdioPipe, fail_fast_tracker: FailFastTracker, @@ -592,6 +592,9 @@ async fn test_specifier_inner( worker.dispatch_beforeunload_event(located_script_name!())?; worker.dispatch_unload_event(located_script_name!())?; + // Ensure all output has been flushed + _ = sender.flush(); + // Ensure the worker has settled so we can catch any remaining unhandled rejections. We don't // want to wait forever here. worker.run_up_to_duration(Duration::from_millis(0)).await?; |