mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
fix(runtime): ignored tests should not cause permission changes (#11278)
This commit is contained in:
parent
0a33cc1951
commit
407de8b834
4 changed files with 32 additions and 5 deletions
|
@ -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,
|
||||
|
|
6
cli/tests/test/ignore_permissions.out
Normal file
6
cli/tests/test/ignore_permissions.out
Normal file
|
@ -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])
|
||||
|
16
cli/tests/test/ignore_permissions.ts
Normal file
16
cli/tests/test/ignore_permissions.ts
Normal file
|
@ -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");
|
||||
},
|
||||
});
|
|
@ -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";
|
||||
|
|
Loading…
Add table
Reference in a new issue