From d043dd86f73f93691c9d9032b38ac94ac16a8793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 24 Mar 2024 23:16:45 +0000 Subject: fix: don't panic in test and bench if ops not available (#23055) Fixes regression introduced in https://github.com/denoland/deno/pull/22112 that removed checks if `Deno.test` or `Deno.bench` are not used in respective subcommands. Closes https://github.com/denoland/deno/issues/23041 --- cli/js/40_bench.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cli/js/40_bench.js') diff --git a/cli/js/40_bench.js b/cli/js/40_bench.js index e1373c990..a94c782fc 100644 --- a/cli/js/40_bench.js +++ b/cli/js/40_bench.js @@ -47,6 +47,11 @@ function bench( optionsOrFn, maybeFn, ) { + // No-op if we're not running in `deno bench` subcommand. + if (typeof op_register_bench !== "function") { + return; + } + if (!registeredWarmupBench) { registeredWarmupBench = true; const warmupBenchDesc = { -- cgit v1.2.3