diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/tests/integration/inspector_tests.rs | 6 | ||||
-rw-r--r-- | cli/tools/bench/mod.rs | 7 | ||||
-rw-r--r-- | cli/tools/repl/session.rs | 11 | ||||
-rw-r--r-- | cli/tools/test/mod.rs | 18 | ||||
-rw-r--r-- | cli/worker.rs | 28 |
5 files changed, 34 insertions, 36 deletions
diff --git a/cli/tests/integration/inspector_tests.rs b/cli/tests/integration/inspector_tests.rs index 36d469196..41c126cdb 100644 --- a/cli/tests/integration/inspector_tests.rs +++ b/cli/tests/integration/inspector_tests.rs @@ -869,7 +869,11 @@ async fn inspector_break_on_first_line_in_test() { .await; assert_starts_with!(&tester.stdout_line(), "running 1 test from"); - assert!(&tester.stdout_line().contains("basic test ... ok")); + let line = tester.stdout_line(); + assert!( + &line.contains("basic test ... ok"), + "Missing content: {line}" + ); tester.child.kill().unwrap(); tester.child.wait().unwrap(); diff --git a/cli/tools/bench/mod.rs b/cli/tools/bench/mod.rs index 57d148463..ed6f10689 100644 --- a/cli/tools/bench/mod.rs +++ b/cli/tools/bench/mod.rs @@ -31,6 +31,7 @@ use deno_core::unsync::spawn; use deno_core::unsync::spawn_blocking; use deno_core::v8; use deno_core::ModuleSpecifier; +use deno_core::PollEventLoopOptions; use deno_runtime::permissions::Permissions; use deno_runtime::permissions::PermissionsContainer; use deno_runtime::tokio_util::create_and_run_current_thread; @@ -254,7 +255,11 @@ async fn bench_specifier_inner( }))?; for (desc, function) in benchmarks { sender.send(BenchEvent::Wait(desc.id))?; - let result = worker.js_runtime.call_and_await(&function).await?; + let call = worker.js_runtime.call(&function); + let result = worker + .js_runtime + .with_event_loop_promise(call, PollEventLoopOptions::default()) + .await?; let scope = &mut worker.js_runtime.handle_scope(); let result = v8::Local::new(scope, result); let result = serde_v8::from_v8::<BenchResult>(scope, result)?; diff --git a/cli/tools/repl/session.rs b/cli/tools/repl/session.rs index 22dd30caf..624d7dafe 100644 --- a/cli/tools/repl/session.rs +++ b/cli/tools/repl/session.rs @@ -202,14 +202,11 @@ impl ReplSession { worker .js_runtime - .with_event_loop( + .with_event_loop_future( session .post_message::<()>("Runtime.enable", None) .boxed_local(), - PollEventLoopOptions { - wait_for_inspector: false, - ..Default::default() - }, + PollEventLoopOptions::default(), ) .await?; @@ -298,14 +295,14 @@ impl ReplSession { self .worker .js_runtime - .with_event_loop( + .with_event_loop_future( self.session.post_message(method, params).boxed_local(), PollEventLoopOptions { - wait_for_inspector: false, // NOTE(bartlomieju): this is an important bit; we don't want to pump V8 // message loop here, so that GC won't run. Otherwise, the resulting // object might be GC'ed before we have a chance to inspect it. pump_v8_message_loop: false, + ..Default::default() }, ) .await diff --git a/cli/tools/test/mod.rs b/cli/tools/test/mod.rs index 840c5ac87..fe1d6cc9c 100644 --- a/cli/tools/test/mod.rs +++ b/cli/tools/test/mod.rs @@ -498,12 +498,9 @@ async fn test_specifier_inner( if let Some(coverage_collector) = coverage_collector.as_mut() { worker .js_runtime - .with_event_loop( + .with_event_loop_future( coverage_collector.stop_collecting().boxed_local(), - PollEventLoopOptions { - wait_for_inspector: false, - ..Default::default() - }, + PollEventLoopOptions::default(), ) .await?; } @@ -574,11 +571,18 @@ pub async fn run_tests_for_worker( // but haven't responded to settle. let waker = noop_waker(); let mut cx = Context::from_waker(&waker); - let _ = worker.js_runtime.poll_event_loop(&mut cx, false); + let _ = worker + .js_runtime + .poll_event_loop(&mut cx, PollEventLoopOptions::default()); } let earlier = SystemTime::now(); - let result = match worker.js_runtime.call_and_await(&function).await { + let call = worker.js_runtime.call(&function); + let result = match worker + .js_runtime + .with_event_loop_promise(call, PollEventLoopOptions::default()) + .await + { Ok(r) => r, Err(error) => { if error.is::<JsError>() { diff --git a/cli/worker.rs b/cli/worker.rs index 22e534e1d..2f0016581 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -211,12 +211,9 @@ impl CliMainWorker { self .worker .js_runtime - .with_event_loop( + .with_event_loop_future( coverage_collector.stop_collecting().boxed_local(), - PollEventLoopOptions { - wait_for_inspector: false, - ..Default::default() - }, + PollEventLoopOptions::default(), ) .await?; } @@ -224,12 +221,9 @@ impl CliMainWorker { self .worker .js_runtime - .with_event_loop( + .with_event_loop_future( hmr_runner.stop().boxed_local(), - PollEventLoopOptions { - wait_for_inspector: false, - ..Default::default() - }, + PollEventLoopOptions::default(), ) .await?; } @@ -340,12 +334,9 @@ impl CliMainWorker { self .worker .js_runtime - .with_event_loop( + .with_event_loop_future( coverage_collector.start_collecting().boxed_local(), - PollEventLoopOptions { - wait_for_inspector: false, - ..Default::default() - }, + PollEventLoopOptions::default(), ) .await?; Ok(Some(coverage_collector)) @@ -371,12 +362,9 @@ impl CliMainWorker { self .worker .js_runtime - .with_event_loop( + .with_event_loop_future( hmr_runner.start().boxed_local(), - PollEventLoopOptions { - wait_for_inspector: false, - ..Default::default() - }, + PollEventLoopOptions::default(), ) .await?; |