diff --git a/cli/ops/testing.rs b/cli/ops/testing.rs index 928fb5a20a..b8995db83d 100644 --- a/cli/ops/testing.rs +++ b/cli/ops/testing.rs @@ -8,10 +8,10 @@ use deno_core::OpState; use deno_runtime::permissions::create_child_permissions; use deno_runtime::permissions::ChildPermissionsArg; use deno_runtime::permissions::Permissions; -use std::sync::mpsc::Sender; +use tokio::sync::mpsc::UnboundedSender; use uuid::Uuid; -pub fn init(sender: Sender) -> Extension { +pub fn init(sender: UnboundedSender) -> Extension { Extension::builder() .ops(vec![ ( @@ -84,7 +84,7 @@ fn op_dispatch_test_event( event: TestEvent, _: (), ) -> Result<(), AnyError> { - let sender = state.borrow::>().clone(); + let sender = state.borrow::>().clone(); sender.send(event).ok(); Ok(()) diff --git a/cli/tools/test.rs b/cli/tools/test.rs index 7e673fac45..74646986d2 100644 --- a/cli/tools/test.rs +++ b/cli/tools/test.rs @@ -50,11 +50,11 @@ use std::collections::HashSet; use std::io::Write; use std::num::NonZeroUsize; use std::path::PathBuf; -use std::sync::mpsc::channel; -use std::sync::mpsc::Sender; use std::sync::Arc; use std::time::Duration; use std::time::Instant; +use tokio::sync::mpsc::unbounded_channel; +use tokio::sync::mpsc::UnboundedSender; /// The test mode is used to determine how a specifier is to be tested. #[derive(Debug, Clone, PartialEq)] @@ -445,7 +445,7 @@ async fn test_specifier( permissions: Permissions, specifier: ModuleSpecifier, mode: TestMode, - channel: Sender, + channel: UnboundedSender, options: TestSpecifierOptions, ) -> Result<(), AnyError> { let mut worker = create_main_worker( @@ -793,7 +793,7 @@ async fn test_specifiers( specifiers_with_mode }; - let (sender, receiver) = channel::(); + let (sender, mut receiver) = unbounded_channel::(); let concurrent_jobs = options.concurrent_jobs; let fail_fast = options.fail_fast; @@ -822,12 +822,12 @@ async fn test_specifiers( create_reporter(concurrent_jobs.get() > 1, log_level != Some(Level::Error)); let handler = { - tokio::task::spawn_blocking(move || { + tokio::task::spawn(async move { let earlier = Instant::now(); let mut summary = TestSummary::new(); let mut used_only = false; - for event in receiver.iter() { + while let Some(event) = receiver.recv().await { match event { TestEvent::Plan(plan) => { summary.total += plan.total;