19
19
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
20
// USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
22
- /* eslint-disable strict */
22
+ 'use strict' ;
23
23
const common = require ( '../common' ) ;
24
+
24
25
const assert = require ( 'assert' ) ;
25
26
const fs = require ( 'fs' ) ;
26
27
27
28
fs . stat ( '.' , common . mustCall ( function ( err , stats ) {
28
29
assert . ifError ( err ) ;
29
30
assert . ok ( stats . mtime instanceof Date ) ;
30
- assert . strictEqual ( this , global ) ;
31
+ // Confirm that we are not running in the context of the internal binding
32
+ // layer.
33
+ // Ref: https://github.com/nodejs/node/commit/463d6bac8b349acc462d345a6e298a76f7d06fb1
34
+ assert . strictEqual ( this , undefined ) ;
31
35
} ) ) ;
32
36
33
37
fs . stat ( '.' , common . mustCall ( function ( err , stats ) {
@@ -38,22 +42,31 @@ fs.stat('.', common.mustCall(function(err, stats) {
38
42
fs . lstat ( '.' , common . mustCall ( function ( err , stats ) {
39
43
assert . ifError ( err ) ;
40
44
assert . ok ( stats . mtime instanceof Date ) ;
41
- assert . strictEqual ( this , global ) ;
45
+ // Confirm that we are not running in the context of the internal binding
46
+ // layer.
47
+ // Ref: https://github.com/nodejs/node/commit/463d6bac8b349acc462d345a6e298a76f7d06fb1
48
+ assert . strictEqual ( this , undefined ) ;
42
49
} ) ) ;
43
50
44
51
// fstat
45
52
fs . open ( '.' , 'r' , undefined , common . mustCall ( function ( err , fd ) {
46
- assert . ok ( ! err ) ;
53
+ assert . ifError ( err ) ;
47
54
assert . ok ( fd ) ;
48
55
49
56
fs . fstat ( fd , common . mustCall ( function ( err , stats ) {
50
57
assert . ifError ( err ) ;
51
58
assert . ok ( stats . mtime instanceof Date ) ;
52
59
fs . close ( fd , assert . ifError ) ;
53
- assert . strictEqual ( this , global ) ;
60
+ // Confirm that we are not running in the context of the internal binding
61
+ // layer.
62
+ // Ref: https://github.com/nodejs/node/commit/463d6bac8b349acc462d345a6e298a76f7d06fb1
63
+ assert . strictEqual ( this , undefined ) ;
54
64
} ) ) ;
55
65
56
- assert . strictEqual ( this , global ) ;
66
+ // Confirm that we are not running in the context of the internal binding
67
+ // layer.
68
+ // Ref: https://github.com/nodejs/node/commit/463d6bac8b349acc462d345a6e298a76f7d06fb1
69
+ assert . strictEqual ( this , null ) ;
57
70
} ) ) ;
58
71
59
72
// fstatSync
@@ -72,13 +85,13 @@ fs.open('.', 'r', undefined, common.mustCall(function(err, fd) {
72
85
73
86
fs . stat ( __filename , common . mustCall ( function ( err , s ) {
74
87
assert . ifError ( err ) ;
75
- assert . strictEqual ( false , s . isDirectory ( ) ) ;
76
- assert . strictEqual ( true , s . isFile ( ) ) ;
77
- assert . strictEqual ( false , s . isSocket ( ) ) ;
78
- assert . strictEqual ( false , s . isBlockDevice ( ) ) ;
79
- assert . strictEqual ( false , s . isCharacterDevice ( ) ) ;
80
- assert . strictEqual ( false , s . isFIFO ( ) ) ;
81
- assert . strictEqual ( false , s . isSymbolicLink ( ) ) ;
88
+ assert . strictEqual ( s . isDirectory ( ) , false ) ;
89
+ assert . strictEqual ( s . isFile ( ) , true ) ;
90
+ assert . strictEqual ( s . isSocket ( ) , false ) ;
91
+ assert . strictEqual ( s . isBlockDevice ( ) , false ) ;
92
+ assert . strictEqual ( s . isCharacterDevice ( ) , false ) ;
93
+ assert . strictEqual ( s . isFIFO ( ) , false ) ;
94
+ assert . strictEqual ( s . isSymbolicLink ( ) , false ) ;
82
95
const keys = [
83
96
'dev' , 'mode' , 'nlink' , 'uid' ,
84
97
'gid' , 'rdev' , 'ino' , 'size' ,
0 commit comments