4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
6
import { deepStrictEqual , doesNotThrow , equal , strictEqual , throws } from 'assert' ;
7
- import { ConfigurationTarget , Disposable , env , EnvironmentVariableCollection , EnvironmentVariableMutator , EnvironmentVariableMutatorType , EnvironmentVariableScope , EventEmitter , ExtensionContext , extensions , ExtensionTerminalOptions , Pseudoterminal , Terminal , TerminalDimensions , TerminalExitReason , TerminalOptions , TerminalState , UIKind , Uri , window , workspace } from 'vscode' ;
7
+ import { ConfigurationTarget , Disposable , env , EnvironmentVariableCollection , EnvironmentVariableMutator , EnvironmentVariableMutatorOptions , EnvironmentVariableMutatorType , EnvironmentVariableScope , EventEmitter , ExtensionContext , extensions , ExtensionTerminalOptions , Pseudoterminal , Terminal , TerminalDimensions , TerminalExitReason , TerminalOptions , TerminalState , UIKind , Uri , window , workspace } from 'vscode' ;
8
8
import { assertNoRpc , poll } from '../utils' ;
9
9
10
10
// Disable terminal tests:
@@ -849,16 +849,20 @@ import { assertNoRpc, poll } from '../utils';
849
849
collection . append ( 'B' , '~b2~' ) ;
850
850
collection . prepend ( 'C' , '~c2~' ) ;
851
851
// Verify get
852
- deepStrictEqual ( collection . get ( 'A' ) , { value : '~a2~' , type : EnvironmentVariableMutatorType . Replace , options : { } } ) ;
853
- deepStrictEqual ( collection . get ( 'B' ) , { value : '~b2~' , type : EnvironmentVariableMutatorType . Append , options : { } } ) ;
854
- deepStrictEqual ( collection . get ( 'C' ) , { value : '~c2~' , type : EnvironmentVariableMutatorType . Prepend , options : { } } ) ;
852
+ const defaultOptions : Required < EnvironmentVariableMutatorOptions > = {
853
+ applyAtProcessCreation : true ,
854
+ applyAtShellIntegration : false
855
+ } ;
856
+ deepStrictEqual ( collection . get ( 'A' ) , { value : '~a2~' , type : EnvironmentVariableMutatorType . Replace , options : defaultOptions } ) ;
857
+ deepStrictEqual ( collection . get ( 'B' ) , { value : '~b2~' , type : EnvironmentVariableMutatorType . Append , options : defaultOptions } ) ;
858
+ deepStrictEqual ( collection . get ( 'C' ) , { value : '~c2~' , type : EnvironmentVariableMutatorType . Prepend , options : defaultOptions } ) ;
855
859
// Verify forEach
856
860
const entries : [ string , EnvironmentVariableMutator ] [ ] = [ ] ;
857
861
collection . forEach ( ( v , m ) => entries . push ( [ v , m ] ) ) ;
858
862
deepStrictEqual ( entries , [
859
- [ 'A' , { value : '~a2~' , type : EnvironmentVariableMutatorType . Replace , options : { } } ] ,
860
- [ 'B' , { value : '~b2~' , type : EnvironmentVariableMutatorType . Append , options : { } } ] ,
861
- [ 'C' , { value : '~c2~' , type : EnvironmentVariableMutatorType . Prepend , options : { } } ]
863
+ [ 'A' , { value : '~a2~' , type : EnvironmentVariableMutatorType . Replace , options : defaultOptions } ] ,
864
+ [ 'B' , { value : '~b2~' , type : EnvironmentVariableMutatorType . Append , options : defaultOptions } ] ,
865
+ [ 'C' , { value : '~c2~' , type : EnvironmentVariableMutatorType . Prepend , options : defaultOptions } ]
862
866
] ) ;
863
867
} ) ;
864
868
@@ -875,18 +879,22 @@ import { assertNoRpc, poll } from '../utils';
875
879
collection . append ( 'B' , '~b2~' ) ;
876
880
collection . prepend ( 'C' , '~c2~' ) ;
877
881
// Verify get for scope
882
+ const defaultOptions : Required < EnvironmentVariableMutatorOptions > = {
883
+ applyAtProcessCreation : true ,
884
+ applyAtShellIntegration : false
885
+ } ;
878
886
const expectedScopedCollection = collection . getScopedEnvironmentVariableCollection ( scope ) ;
879
- deepStrictEqual ( expectedScopedCollection . get ( 'A' ) , { value : 'scoped~a2~' , type : EnvironmentVariableMutatorType . Replace , options : { } } ) ;
880
- deepStrictEqual ( expectedScopedCollection . get ( 'B' ) , { value : 'scoped~b2~' , type : EnvironmentVariableMutatorType . Append , options : { } } ) ;
881
- deepStrictEqual ( expectedScopedCollection . get ( 'C' ) , { value : 'scoped~c2~' , type : EnvironmentVariableMutatorType . Prepend , options : { } } ) ;
887
+ deepStrictEqual ( expectedScopedCollection . get ( 'A' ) , { value : 'scoped~a2~' , type : EnvironmentVariableMutatorType . Replace , options : defaultOptions } ) ;
888
+ deepStrictEqual ( expectedScopedCollection . get ( 'B' ) , { value : 'scoped~b2~' , type : EnvironmentVariableMutatorType . Append , options : defaultOptions } ) ;
889
+ deepStrictEqual ( expectedScopedCollection . get ( 'C' ) , { value : 'scoped~c2~' , type : EnvironmentVariableMutatorType . Prepend , options : defaultOptions } ) ;
882
890
883
891
// Verify forEach
884
892
const entries : [ string , EnvironmentVariableMutator ] [ ] = [ ] ;
885
893
expectedScopedCollection . forEach ( ( v , m ) => entries . push ( [ v , m ] ) ) ;
886
894
deepStrictEqual ( entries . map ( v => v [ 1 ] ) , [
887
- { value : 'scoped~a2~' , type : EnvironmentVariableMutatorType . Replace , options : { } } ,
888
- { value : 'scoped~b2~' , type : EnvironmentVariableMutatorType . Append , options : { } } ,
889
- { value : 'scoped~c2~' , type : EnvironmentVariableMutatorType . Prepend , options : { } }
895
+ { value : 'scoped~a2~' , type : EnvironmentVariableMutatorType . Replace , options : defaultOptions } ,
896
+ { value : 'scoped~b2~' , type : EnvironmentVariableMutatorType . Append , options : defaultOptions } ,
897
+ { value : 'scoped~c2~' , type : EnvironmentVariableMutatorType . Prepend , options : defaultOptions }
890
898
] ) ;
891
899
} ) ;
892
900
} ) ;
0 commit comments