summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tests/integration/test_tests.rs6
-rw-r--r--cli/tests/test/ignore_permissions.out6
-rw-r--r--cli/tests/test/ignore_permissions.ts16
-rw-r--r--runtime/js/40_testing.js9
4 files changed, 32 insertions, 5 deletions
diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs
index 829dcfbb3..3bc81c5d3 100644
--- a/cli/tests/integration/test_tests.rs
+++ b/cli/tests/integration/test_tests.rs
@@ -31,6 +31,12 @@ itest!(ignore {
output: "test/ignore.out",
});
+itest!(ignore_permissions {
+ args: "test --unstable test/ignore_permissions.ts",
+ exit_code: 0,
+ output: "test/ignore_permissions.out",
+});
+
itest!(fail {
args: "test test/fail.ts",
exit_code: 1,
diff --git a/cli/tests/test/ignore_permissions.out b/cli/tests/test/ignore_permissions.out
new file mode 100644
index 000000000..c4d273d8f
--- /dev/null
+++ b/cli/tests/test/ignore_permissions.out
@@ -0,0 +1,6 @@
+Check [WILDCARD]/test/ignore_permissions.ts
+running 1 test from [WILDCARD]/test/ignore_permissions.ts
+test ignore ... ignored ([WILDCARD])
+
+test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out ([WILDCARD])
+
diff --git a/cli/tests/test/ignore_permissions.ts b/cli/tests/test/ignore_permissions.ts
new file mode 100644
index 000000000..bd0567a46
--- /dev/null
+++ b/cli/tests/test/ignore_permissions.ts
@@ -0,0 +1,16 @@
+Deno.test({
+ name: "ignore",
+ permissions: {
+ read: true,
+ write: true,
+ net: true,
+ env: true,
+ run: true,
+ plugin: true,
+ hrtime: true,
+ },
+ ignore: true,
+ fn() {
+ throw new Error("unreachable");
+ },
+});
diff --git a/runtime/js/40_testing.js b/runtime/js/40_testing.js
index 3107f70a1..0106f895a 100644
--- a/runtime/js/40_testing.js
+++ b/runtime/js/40_testing.js
@@ -192,17 +192,16 @@ finishing test case.`;
}
async function runTest({ ignore, fn, permissions }) {
+ if (ignore) {
+ return "ignored";
+ }
+
let token = null;
try {
if (permissions) {
token = pledgeTestPermissions(permissions);
}
-
- if (ignore) {
- return "ignored";
- }
-
await fn();
return "ok";