File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 3
3
// node::NewContext calls this script
4
4
5
5
( function ( global ) {
6
+ // https://github.com/tc39/proposal-global
7
+ // https://github.com/nodejs/node/pull/22835
8
+ // TODO(devsnek,ljharb) remove when V8 71 lands
9
+ Object . defineProperty ( global , 'globalThis' , {
10
+ value : global ,
11
+ writable : true ,
12
+ enumerable : false ,
13
+ configurable : true ,
14
+ } ) ;
15
+
6
16
// https://github.com/nodejs/node/issues/14909
7
17
if ( global . Intl ) delete global . Intl . v8BreakIterator ;
8
18
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ require ( '../common' ) ;
4
+ const assert = require ( 'assert' ) ;
5
+
6
+ const actualGlobal = Function ( 'return this' ) ( ) ;
7
+
8
+ const {
9
+ value,
10
+ configurable,
11
+ enumerable,
12
+ writable
13
+ } = Object . getOwnPropertyDescriptor ( actualGlobal , 'globalThis' ) ;
14
+
15
+ assert . strictEqual ( value , actualGlobal , 'globalThis should be global object' ) ;
16
+ assert . strictEqual ( configurable , true , 'globalThis should be configurable' ) ;
17
+ assert . strictEqual ( enumerable , false , 'globalThis should be non-enumerable' ) ;
18
+ assert . strictEqual ( writable , true , 'globalThis should be writable' ) ;
You can’t perform that action at this time.
0 commit comments