mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
fix(cli): force flush output after test unloads (#22660)
Fixes flake in load_unload test
This commit is contained in:
parent
22a4205a68
commit
2e4a1fc3e8
1 changed files with 6 additions and 3 deletions
|
@ -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?;
|
||||
|
|
Loading…
Reference in a new issue