summaryrefslogtreecommitdiff
path: root/cli/worker.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/worker.rs')
-rw-r--r--cli/worker.rs49
1 files changed, 9 insertions, 40 deletions
diff --git a/cli/worker.rs b/cli/worker.rs
index d7c185fd9..1c4c6475a 100644
--- a/cli/worker.rs
+++ b/cli/worker.rs
@@ -7,7 +7,6 @@ use deno_core::error::AnyError;
use deno_core::futures::task::LocalFutureObj;
use deno_core::futures::FutureExt;
use deno_core::located_script_name;
-use deno_core::serde_json::json;
use deno_core::Extension;
use deno_core::ModuleId;
use deno_graph::source::ResolveResponse;
@@ -220,10 +219,7 @@ impl CliMainWorker {
&mut self,
mode: TestMode,
) -> Result<(), AnyError> {
- self.worker.js_runtime.execute_script(
- &located_script_name!(),
- r#"Deno[Deno.internal].enableTestAndBench()"#,
- )?;
+ self.worker.enable_test();
// Enable op call tracing in core to enable better debugging of op sanitizer
// failures.
@@ -273,17 +269,10 @@ impl CliMainWorker {
}
self.worker.dispatch_load_event(&located_script_name!())?;
-
- let test_result = self.worker.js_runtime.execute_script(
- &located_script_name!(),
- &format!(
- r#"Deno[Deno.internal].runTests({})"#,
- json!({ "shuffle": self.ps.options.shuffle_tests() }),
- ),
- )?;
-
- self.worker.js_runtime.resolve_value(test_result).await?;
-
+ self
+ .worker
+ .run_tests(&self.ps.options.shuffle_tests())
+ .await?;
loop {
if !self
.worker
@@ -309,10 +298,7 @@ impl CliMainWorker {
&mut self,
mode: TestMode,
) -> Result<(), AnyError> {
- self.worker.js_runtime.execute_script(
- &located_script_name!(),
- r#"Deno[Deno.internal].enableTestAndBench()"#,
- )?;
+ self.worker.enable_test();
self
.worker
@@ -328,14 +314,7 @@ impl CliMainWorker {
}
self.worker.dispatch_load_event(&located_script_name!())?;
-
- let test_result = self.worker.js_runtime.execute_script(
- &located_script_name!(),
- r#"Deno[Deno.internal].runTests()"#,
- )?;
-
- self.worker.js_runtime.resolve_value(test_result).await?;
-
+ self.worker.run_tests(&None).await?;
loop {
if !self
.worker
@@ -350,10 +329,7 @@ impl CliMainWorker {
}
pub async fn run_bench_specifier(&mut self) -> Result<(), AnyError> {
- self.worker.js_runtime.execute_script(
- &located_script_name!(),
- r#"Deno[Deno.internal].enableTestAndBench()"#,
- )?;
+ self.worker.enable_bench();
if self.ps.options.compat() {
self.worker.execute_side_module(&compat::GLOBAL_URL).await?;
@@ -383,14 +359,7 @@ impl CliMainWorker {
}
self.worker.dispatch_load_event(&located_script_name!())?;
-
- let bench_result = self.worker.js_runtime.execute_script(
- &located_script_name!(),
- r#"Deno[Deno.internal].runBenchmarks()"#,
- )?;
-
- self.worker.js_runtime.resolve_value(bench_result).await?;
-
+ self.worker.run_benchmarks().await?;
loop {
if !self
.worker