File tree Expand file tree Collapse file tree 3 files changed +30
-11
lines changed
tests/specs/permission/ignore_env Expand file tree Collapse file tree 3 files changed +30
-11
lines changed Original file line number Diff line number Diff line change @@ -842,6 +842,11 @@ impl<
842842 ) -> PermissionState {
843843 if self . is_flag_denied ( desc) || self . is_prompt_denied ( desc) {
844844 PermissionState :: Denied
845+ } else if desc
846+ . map ( |desc| self . flag_ignored_list . iter ( ) . any ( |v| desc. matches_deny ( v) ) )
847+ . unwrap_or ( false )
848+ {
849+ PermissionState :: Ignored
845850 } else if self . is_granted ( desc) {
846851 match allow_partial {
847852 AllowPartial :: TreatAsGranted => PermissionState :: Granted ,
@@ -860,7 +865,7 @@ impl<
860865 }
861866 }
862867 }
863- } else if self . is_flag_ignored ( desc ) {
868+ } else if self . flag_ignored_global {
864869 PermissionState :: Ignored
865870 } else if matches ! ( allow_partial, AllowPartial :: TreatAsDenied )
866871 && self . is_partial_flag_denied ( desc)
@@ -957,16 +962,6 @@ impl<
957962 }
958963 }
959964
960- fn is_flag_ignored ( & self , query : Option < & TAllowDesc :: QueryDesc < ' _ > > ) -> bool {
961- match query {
962- Some ( query) => {
963- self . flag_ignored_global
964- || self . flag_ignored_list . iter ( ) . any ( |v| query. matches_deny ( v) )
965- }
966- None => self . flag_ignored_global ,
967- }
968- }
969-
970965 fn is_prompt_denied (
971966 & self ,
972967 query : Option < & TAllowDesc :: QueryDesc < ' _ > > ,
Original file line number Diff line number Diff line change 1+ {
2+ "envs" : {
3+ "VAR1" : " 1" ,
4+ "VAR2" : " 2"
5+ },
6+ "tests" : {
7+ "all" : {
8+ "args" : " run --ignore-env main.ts" ,
9+ "output" : " undefined\n undefined\n [Object: null prototype] {}\n "
10+ },
11+ "some" : {
12+ "args" : " run --ignore-env=VAR1 main.ts" ,
13+ "output" : " undefined\n error: [WILDCARD]\n " ,
14+ "exitCode" : 1
15+ },
16+ "some_allow_env" : {
17+ "args" : " run --ignore-env=VAR1 --allow-env main.ts" ,
18+ "output" : " undefined\n 2\n "
19+ }
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ console . log ( Deno . env . get ( "VAR1" ) ) ;
2+ console . log ( Deno . env . get ( "VAR2" ) ) ;
3+ console . log ( Deno . env . toObject ( ) ) ;
You can’t perform that action at this time.
0 commit comments