diff options
author | Casper Beyer <caspervonb@pm.me> | 2021-04-26 05:38:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-25 23:38:59 +0200 |
commit | f3751e498faabd524494a4b70c49b1f53fe5ebdd (patch) | |
tree | 9f3cf5b15fc10d0ef12f78c984fbbb59554343ef /runtime/ops/worker_host.rs | |
parent | 7063e449f11ab2cff492ba90314da7a0bcd994a6 (diff) |
feat(cli): add test permissions to Deno.test (#10188)
This commits adds adds "permissions" option to the test definitions
which allows tests to run with different permission sets than
the process's permission.
The change will only be in effect within the test function, once the
test has completed the original process permission set is restored.
Test permissions cannot exceed the process's permission.
You can only narrow or drop permissions, failure to acquire a
permission results in an error being thrown and the test case will fail.
Diffstat (limited to 'runtime/ops/worker_host.rs')
-rw-r--r-- | runtime/ops/worker_host.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/ops/worker_host.rs b/runtime/ops/worker_host.rs index 905ae1334..ff861c01d 100644 --- a/runtime/ops/worker_host.rs +++ b/runtime/ops/worker_host.rs @@ -228,7 +228,7 @@ fn merge_run_permission( Ok(main) } -fn create_worker_permissions( +pub fn create_worker_permissions( main_perms: Permissions, worker_perms: PermissionsArg, ) -> Result<Permissions, AnyError> { @@ -244,7 +244,7 @@ fn create_worker_permissions( } #[derive(Debug, Deserialize)] -struct PermissionsArg { +pub struct PermissionsArg { #[serde(default, deserialize_with = "as_unary_env_permission")] env: Option<UnaryPermission<EnvDescriptor>>, #[serde(default, deserialize_with = "as_permission_state")] |