summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2023-04-01 21:20:16 +0100
committerGitHub <noreply@github.com>2023-04-01 16:20:16 -0400
commite5588d2f1eb84947c8691fffbcf719a73557a3f5 (patch)
tree2fde86d5178a7670dbf620e854d3f5f7accc150d
parent0210c1cadf305170aa1aa7325ff6f50d78c9f5dc (diff)
fix(test): don't swallow sanitizer errors with permissions (#18550)
Missing `return` from #18246.
-rw-r--r--cli/js/40_testing.js2
-rw-r--r--cli/tests/testdata/test/ops_sanitizer_unstable.out2
-rw-r--r--cli/tests/testdata/test/ops_sanitizer_unstable.ts9
3 files changed, 9 insertions, 4 deletions
diff --git a/cli/js/40_testing.js b/cli/js/40_testing.js
index 74fbb8da3..babbec8c2 100644
--- a/cli/js/40_testing.js
+++ b/cli/js/40_testing.js
@@ -481,7 +481,7 @@ function withPermissions(fn, permissions) {
const token = pledgePermissions(permissions);
try {
- await fn(...new SafeArrayIterator(params));
+ return await fn(...new SafeArrayIterator(params));
} finally {
restorePermissions(token);
}
diff --git a/cli/tests/testdata/test/ops_sanitizer_unstable.out b/cli/tests/testdata/test/ops_sanitizer_unstable.out
index 2d5ab9079..a4f47a749 100644
--- a/cli/tests/testdata/test/ops_sanitizer_unstable.out
+++ b/cli/tests/testdata/test/ops_sanitizer_unstable.out
@@ -10,7 +10,7 @@ error: Leaking async ops:
- 1 async operation to sleep for a duration was started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operation was started here:
at [WILDCARD]
at setInterval ([WILDCARD])
- at [WILDCARD]/testdata/test/ops_sanitizer_unstable.ts:3:3
+ at fn ([WILDCARD]/testdata/test/ops_sanitizer_unstable.ts:7:5)
at [WILDCARD]
FAILURES
diff --git a/cli/tests/testdata/test/ops_sanitizer_unstable.ts b/cli/tests/testdata/test/ops_sanitizer_unstable.ts
index 4f409e73c..d1b554adf 100644
--- a/cli/tests/testdata/test/ops_sanitizer_unstable.ts
+++ b/cli/tests/testdata/test/ops_sanitizer_unstable.ts
@@ -1,4 +1,9 @@
Deno.test("no-op", function () {});
-Deno.test("leak interval", function () {
- setInterval(function () {}, 100000);
+Deno.test({
+ name: "leak interval",
+ // regression test for sanitizer errors being swallowed with permissions.
+ permissions: {},
+ fn() {
+ setInterval(function () {}, 100000);
+ },
});