From 9f2e56ba96b847d6275ac26656d9d522fca252f7 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 10 Nov 2023 06:34:41 -0800 Subject: chore: use internal namespace in 40_testing.js (#21141) Towards #21136 - [x] assign serializePermissions, setTimeout and setExitHandler APIs to internal namespace - [x] remove usage of assert --- cli/js/40_testing.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'cli/js/40_testing.js') diff --git a/cli/js/40_testing.js b/cli/js/40_testing.js index 81fedb83e..4f8153f5a 100644 --- a/cli/js/40_testing.js +++ b/cli/js/40_testing.js @@ -7,11 +7,13 @@ const core = globalThis.Deno.core; const ops = core.ops; -import { setExitHandler } from "ext:runtime/30_os.js"; -import { Console } from "ext:deno_console/01_console.js"; -import { serializePermissions } from "ext:runtime/10_permissions.js"; -import { setTimeout } from "ext:deno_web/02_timers.js"; -import { assert } from "ext:deno_web/00_infra.js"; + +const internals = globalThis.__bootstrap.internals; +const { + setExitHandler, + Console, + serializePermissions, +} = internals; const opSanitizerDelayResolveQueue = []; let hasSetOpSanitizerDelayMacrotask = false; @@ -445,8 +447,7 @@ function assertResources(fn) { function assertExit(fn, isTest) { return async function exitSanitizer(...params) { setExitHandler((exitCode) => { - assert( - false, + throw new Error( `${ isTest ? "Test case" : "Bench" } attempted to exit with exit code: ${exitCode}`, @@ -1155,8 +1156,7 @@ function wrapBenchmark(desc) { if (desc.sanitizeExit) { setExitHandler((exitCode) => { - assert( - false, + throw new Error( `Bench attempted to exit with exit code: ${exitCode}`, ); }); -- cgit v1.2.3