2
2
/* eslint-disable max-len */
3
3
4
4
require ( '../common' ) ;
5
- // first things first, set the timezone; see tzset(3)
6
- process . env . TZ = 'Europe/Amsterdam' ;
7
-
8
- var assert = require ( 'assert' ) ;
9
- var spawn = require ( 'child_process' ) . spawn ;
5
+ const assert = require ( 'assert' ) ;
6
+ const spawn = require ( 'child_process' ) . spawn ;
10
7
11
8
/* For the moment we are not going to support setting the timezone via the
12
9
* environment variables. The problem is that various V8 platform backends
@@ -16,6 +13,8 @@ var spawn = require('child_process').spawn;
16
13
https://github.com/joyent/node/blob/08782931205bc4f6d28102ebc29fd806e8ccdf1f/deps/v8/src/platform-linux.cc#L339-345
17
14
https://github.com/joyent/node/blob/08782931205bc4f6d28102ebc29fd806e8ccdf1f/deps/v8/src/platform-win32.cc#L590-596
18
15
16
+ // first things first, set the timezone; see tzset(3)
17
+ process.env.TZ = 'Europe/Amsterdam';
19
18
20
19
// time difference between Greenwich and Amsterdam is +2 hours in the summer
21
20
date = new Date('Fri, 10 Sep 1982 03:15:00 GMT');
@@ -27,28 +26,28 @@ assert.equal(5, date.getHours());
27
26
// changes in environment should be visible to child processes
28
27
if ( process . argv [ 2 ] == 'you-are-the-child' ) {
29
28
// failed assertion results in process exiting with status code 1
30
- assert . equal ( false , 'NODE_PROCESS_ENV_DELETED' in process . env ) ;
31
- assert . equal ( 42 , process . env . NODE_PROCESS_ENV ) ;
32
- assert . equal ( 'asdf' , process . env . hasOwnProperty ) ;
29
+ assert . strictEqual ( false , 'NODE_PROCESS_ENV_DELETED' in process . env ) ;
30
+ assert . strictEqual ( '42' , process . env . NODE_PROCESS_ENV ) ;
31
+ assert . strictEqual ( 'asdf' , process . env . hasOwnProperty ) ;
33
32
var hasOwnProperty = Object . prototype . hasOwnProperty ;
34
33
const has = hasOwnProperty . call ( process . env , 'hasOwnProperty' ) ;
35
- assert . equal ( true , has ) ;
34
+ assert . strictEqual ( true , has ) ;
36
35
process . exit ( 0 ) ;
37
36
} else {
38
- assert . equal ( Object . prototype . hasOwnProperty , process . env . hasOwnProperty ) ;
37
+ assert . strictEqual ( Object . prototype . hasOwnProperty , process . env . hasOwnProperty ) ;
39
38
const has = process . env . hasOwnProperty ( 'hasOwnProperty' ) ;
40
- assert . equal ( false , has ) ;
39
+ assert . strictEqual ( false , has ) ;
41
40
42
41
process . env . hasOwnProperty = 'asdf' ;
43
42
44
43
process . env . NODE_PROCESS_ENV = 42 ;
45
- assert . equal ( 42 , process . env . NODE_PROCESS_ENV ) ;
44
+ assert . strictEqual ( '42' , process . env . NODE_PROCESS_ENV ) ;
46
45
47
46
process . env . NODE_PROCESS_ENV_DELETED = 42 ;
48
- assert . equal ( true , 'NODE_PROCESS_ENV_DELETED' in process . env ) ;
47
+ assert . strictEqual ( true , 'NODE_PROCESS_ENV_DELETED' in process . env ) ;
49
48
50
49
delete process . env . NODE_PROCESS_ENV_DELETED ;
51
- assert . equal ( false , 'NODE_PROCESS_ENV_DELETED' in process . env ) ;
50
+ assert . strictEqual ( false , 'NODE_PROCESS_ENV_DELETED' in process . env ) ;
52
51
53
52
var child = spawn ( process . argv [ 0 ] , [ process . argv [ 1 ] , 'you-are-the-child' ] ) ;
54
53
child . stdout . on ( 'data' , function ( data ) { console . log ( data . toString ( ) ) ; } ) ;
@@ -59,3 +58,8 @@ if (process.argv[2] == 'you-are-the-child') {
59
58
}
60
59
} ) ;
61
60
}
61
+
62
+ // delete should return true except for non-configurable properties
63
+ // https://github.com/nodejs/node/issues/7960
64
+ delete process . env . NON_EXISTING_VARIABLE ;
65
+ assert . strictEqual ( true , delete process . env . NON_EXISTING_VARIABLE ) ;
0 commit comments