11'use strict' ; 
2- /* eslint-disable max-len */ 
32
43require ( '../common' ) ; 
54const  assert  =  require ( 'assert' ) ; 
6- const  spawn  =  require ( 'child_process' ) . spawn ; 
7- 
8- /* For the moment we are not going to support setting the timezone via the 
9-  * environment variables. The problem is that various V8 platform backends 
10-  * deal with timezone in different ways. The windows platform backend caches 
11-  * the timezone value while the Linux one hits libc for every query. 
12- 
13- https://github.com/joyent/node/blob/08782931205bc4f6d28102ebc29fd806e8ccdf1f/deps/v8/src/platform-linux.cc#L339-345 
14- https://github.com/joyent/node/blob/08782931205bc4f6d28102ebc29fd806e8ccdf1f/deps/v8/src/platform-win32.cc#L590-596 
15- 
16- // first things first, set the timezone; see tzset(3) 
17- process.env.TZ = 'Europe/Amsterdam'; 
18- 
19- // time difference between Greenwich and Amsterdam is +2 hours in the summer 
20- date = new Date('Fri, 10 Sep 1982 03:15:00 GMT'); 
21- assert.equal(3, date.getUTCHours()); 
22- assert.equal(5, date.getHours()); 
23- */ 
24- 
255
266// changes in environment should be visible to child processes 
27- if  ( process . argv [ 2 ]  ==  'you-are-the-child' )  { 
28-   // failed assertion results in process exiting with status code 1 
7+ if  ( process . argv [ 2 ]  ===  'you-are-the-child' )  { 
298  assert . strictEqual ( false ,  'NODE_PROCESS_ENV_DELETED'  in  process . env ) ; 
309  assert . strictEqual ( '42' ,  process . env . NODE_PROCESS_ENV ) ; 
3110  assert . strictEqual ( 'asdf' ,  process . env . hasOwnProperty ) ; 
32-   var  hasOwnProperty  =  Object . prototype . hasOwnProperty ; 
11+   const  hasOwnProperty  =  Object . prototype . hasOwnProperty ; 
3312  const  has  =  hasOwnProperty . call ( process . env ,  'hasOwnProperty' ) ; 
3413  assert . strictEqual ( true ,  has ) ; 
3514  process . exit ( 0 ) ; 
36- }  else  { 
37-   assert . strictEqual ( Object . prototype . hasOwnProperty ,  process . env . hasOwnProperty ) ; 
15+ } 
16+ 
17+ { 
18+   const  spawn  =  require ( 'child_process' ) . spawn ; 
19+ 
20+   assert . strictEqual ( Object . prototype . hasOwnProperty , 
21+                      process . env . hasOwnProperty ) ; 
3822  const  has  =  process . env . hasOwnProperty ( 'hasOwnProperty' ) ; 
3923  assert . strictEqual ( false ,  has ) ; 
4024
@@ -49,17 +33,37 @@ if (process.argv[2] == 'you-are-the-child') {
4933  delete  process . env . NODE_PROCESS_ENV_DELETED ; 
5034  assert . strictEqual ( false ,  'NODE_PROCESS_ENV_DELETED'  in  process . env ) ; 
5135
52-   var  child  =  spawn ( process . argv [ 0 ] ,  [ process . argv [ 1 ] ,  'you-are-the-child' ] ) ; 
36+   const  child  =  spawn ( process . argv [ 0 ] ,  [ process . argv [ 1 ] ,  'you-are-the-child' ] ) ; 
5337  child . stdout . on ( 'data' ,  function ( data )  {  console . log ( data . toString ( ) ) ;  } ) ; 
5438  child . stderr . on ( 'data' ,  function ( data )  {  console . log ( data . toString ( ) ) ;  } ) ; 
5539  child . on ( 'exit' ,  function ( statusCode )  { 
56-     if  ( statusCode  !=  0 )  { 
40+     if  ( statusCode  !==   0 )  { 
5741      process . exit ( statusCode ) ;   // failed assertion in child process 
5842    } 
5943  } ) ; 
6044} 
6145
46+ 
6247// delete should return true except for non-configurable properties 
6348// https://github.com/nodejs/node/issues/7960 
6449delete  process . env . NON_EXISTING_VARIABLE ; 
6550assert . strictEqual ( true ,  delete  process . env . NON_EXISTING_VARIABLE ) ; 
51+ 
52+ /* eslint-disable max-len */ 
53+ /* For the moment we are not going to support setting the timezone via the 
54+  * environment variables. The problem is that various V8 platform backends 
55+  * deal with timezone in different ways. The windows platform backend caches 
56+  * the timezone value while the Linux one hits libc for every query. 
57+ 
58+ https://github.com/joyent/node/blob/08782931205bc4f6d28102ebc29fd806e8ccdf1f/deps/v8/src/platform-linux.cc#L339-345 
59+ https://github.com/joyent/node/blob/08782931205bc4f6d28102ebc29fd806e8ccdf1f/deps/v8/src/platform-win32.cc#L590-596 
60+ 
61+ // set the timezone; see tzset(3) 
62+ process.env.TZ = 'Europe/Amsterdam'; 
63+ 
64+ // time difference between Greenwich and Amsterdam is +2 hours in the summer 
65+ date = new Date('Fri, 10 Sep 1982 03:15:00 GMT'); 
66+ assert.equal(3, date.getUTCHours()); 
67+ assert.equal(5, date.getHours()); 
68+ */ 
69+ /* eslint-enable max-len */ 
0 commit comments