diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2023-11-10 06:34:41 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 14:34:41 +0000 |
commit | 9f2e56ba96b847d6275ac26656d9d522fca252f7 (patch) | |
tree | 1c953d4c6df97cd33615c0ab80a02e65ca8ef4d9 /cli/js/40_testing.js | |
parent | 8ecb649182966bd77a7ddac9797496291cbf9521 (diff) |
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
Diffstat (limited to 'cli/js/40_testing.js')
-rw-r--r-- | cli/js/40_testing.js | 18 |
1 files changed, 9 insertions, 9 deletions
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}`, ); }); |