@@ -74,14 +74,14 @@ describe('FunctionEnvironmentReloadHandler', () => {
74
74
let originalEnv : NodeJS . ProcessEnv ;
75
75
let originalCwd : string ;
76
76
before ( ( ) => {
77
+ originalEnv = { ...process . env } ;
77
78
originalCwd = process . cwd ( ) ;
78
- originalEnv = process . env ;
79
79
( { stream, channel } = beforeEventHandlerSuite ( ) ) ;
80
80
channel . hostVersion = '2.7.0' ;
81
81
} ) ;
82
82
83
83
after ( ( ) => {
84
- process . env = originalEnv ;
84
+ Object . assign ( process . env , originalEnv ) ;
85
85
} ) ;
86
86
87
87
afterEach ( async ( ) => {
@@ -108,6 +108,32 @@ describe('FunctionEnvironmentReloadHandler', () => {
108
108
expect ( process . env . PlaceholderVariable ) . to . be . undefined ;
109
109
} ) ;
110
110
111
+ it ( 'preserves OS-specific casing behavior of environment variables' , async ( ) => {
112
+ process . env . PlaceholderVariable = 'TRUE' ;
113
+ stream . addTestMessage ( {
114
+ requestId : 'id' ,
115
+ functionEnvironmentReloadRequest : {
116
+ environmentVariables : {
117
+ hello : 'world' ,
118
+ SystemDrive : 'Q:' ,
119
+ } ,
120
+ functionAppDirectory : null ,
121
+ } ,
122
+ } ) ;
123
+ await stream . assertCalledWith ( Msg . reloadEnvVarsLog ( 2 ) , Msg . reloadSuccess ) ;
124
+ expect ( process . env . hello ) . to . equal ( 'world' ) ;
125
+ expect ( process . env . SystemDrive ) . to . equal ( 'Q:' ) ;
126
+ expect ( process . env . PlaceholderVariable ) . to . be . undefined ;
127
+ expect ( process . env . placeholdervariable ) . to . be . undefined ;
128
+ if ( process . platform === 'win32' ) {
129
+ expect ( process . env . HeLlO ) . to . equal ( 'world' ) ;
130
+ expect ( process . env . systemdrive ) . to . equal ( 'Q:' ) ;
131
+ } else {
132
+ expect ( process . env . HeLlO ) . to . be . undefined ;
133
+ expect ( process . env . systemdrive ) . to . be . undefined ;
134
+ }
135
+ } ) ;
136
+
111
137
it ( 'reloading environment variables removes existing environment variables' , async ( ) => {
112
138
process . env . PlaceholderVariable = 'TRUE' ;
113
139
process . env . NODE_ENV = 'Debug' ;
0 commit comments