1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

fix(node/test): disable Deno test sanitizers (#22480)

Closes #22473
This commit is contained in:
David Sherret 2024-02-20 23:22:07 -05:00 committed by GitHub
parent e32c704970
commit 6592a92c20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 47 additions and 0 deletions

View file

@ -61,6 +61,9 @@ class NodeTestContext {
await prepared.fn(newNodeTextContext);
},
ignore: prepared.options.todo || prepared.options.skip,
sanitizeExit: false,
sanitizeOps: false,
sanitizeResources: false,
}).then(() => undefined);
}
@ -131,6 +134,9 @@ function prepareDenoTest(name, options, fn, overrides) {
fn: wrapTestFn(prepared.fn, resolve),
only: prepared.options.only,
ignore: prepared.options.todo || prepared.options.skip,
sanitizeExit: false,
sanitizeOps: false,
sanitizeResources: false,
};
Deno.test(denoTestOptions);
return promise;

View file

@ -11,3 +11,11 @@ itest!(node_test_module {
exit_code: 1,
http_server: true,
});
itest!(node_test_module_no_sanitizers {
args: "test -A --no-check node/test_no_sanitizers/test.js",
output: "node/test_no_sanitizers/test.out",
envs: env_vars_for_npm_tests(),
exit_code: 123,
http_server: true,
});

View file

@ -0,0 +1,28 @@
import test from "node:test";
test("should not complain about resource and op sanitizers", async (t) => {
// resource
const _file1 = Deno.open("welcome.ts");
await t.test("nested test", () => {
// resource
const _file2 = Deno.open("cat.ts");
// op
crypto.subtle.digest(
"SHA-256",
new TextEncoder().encode("a".repeat(1_000_000)),
);
});
// op
crypto.subtle.digest(
"SHA-256",
new TextEncoder().encode("a".repeat(1_000_000)),
);
});
test("should allow exit", () => {
// no exit sanitizers
Deno.exit(123);
});

View file

@ -0,0 +1,5 @@
running 2 tests from ./node/test_no_sanitizers/test.js
should not complain about resource and op sanitizers ...
nested test ... ok ([WILDCARD])
should not complain about resource and op sanitizers ... ok ([WILDCARD])
should allow exit ...