File tree Expand file tree Collapse file tree 2 files changed +40
-5
lines changed Expand file tree Collapse file tree 2 files changed +40
-5
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,6 @@ function networkInterfaces() {
140140module . exports = exports = {
141141 arch,
142142 cpus,
143- EOL : isWindows ? '\r\n' : '\n' ,
144143 endianness,
145144 freemem : getFreeMem ,
146145 homedir : getHomeDirectory ,
@@ -162,8 +161,17 @@ module.exports = exports = {
162161 tmpDir : deprecate ( tmpdir , tmpDirDeprecationMsg , 'DEP0022' )
163162} ;
164163
165- Object . defineProperty ( module . exports , 'constants' , {
166- configurable : false ,
167- enumerable : true ,
168- value : constants
164+ Object . defineProperties ( module . exports , {
165+ constants : {
166+ configurable : false ,
167+ enumerable : true ,
168+ value : constants
169+ } ,
170+
171+ EOL : {
172+ configurable : true ,
173+ enumerable : true ,
174+ writable : false ,
175+ value : isWindows ? '\r\n' : '\n'
176+ }
169177} ) ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const common = require ( '../common' ) ;
4+ const assert = require ( 'assert' ) ;
5+ const os = require ( 'os' ) ;
6+
7+ const eol = common . isWindows ? '\r\n' : '\n' ;
8+
9+ assert . strictEqual ( os . EOL , eol ) ;
10+
11+ common . expectsError ( function ( ) {
12+ os . EOL = 123 ;
13+ } , {
14+ type : TypeError ,
15+ message : / ^ C a n n o t a s s i g n t o r e a d o n l y p r o p e r t y ' E O L ' o f o b j e c t ' # < O b j e c t > ' $ /
16+ } ) ;
17+
18+ const foo = 'foo' ;
19+ Object . defineProperties ( os , {
20+ EOL : {
21+ configurable : true ,
22+ enumerable : true ,
23+ writable : false ,
24+ value : foo
25+ }
26+ } ) ;
27+ assert . strictEqual ( os . EOL , foo ) ;
You can’t perform that action at this time.
0 commit comments