mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 12:49:10 +00:00
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
This commit is contained in:
parent
8ecb649182
commit
9f2e56ba96
5 changed files with 21 additions and 15 deletions
|
@ -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}`,
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue