@@ -5,8 +5,8 @@ const assert = require('assert');
5
5
assert . ok ( process . stdout . writable ) ;
6
6
assert . ok ( process . stderr . writable ) ;
7
7
// Support legacy API
8
- assert . equal ( 'number' , typeof process . stdout . fd ) ;
9
- assert . equal ( 'number' , typeof process . stderr . fd ) ;
8
+ assert . strictEqual ( 'number' , typeof process . stdout . fd ) ;
9
+ assert . strictEqual ( 'number' , typeof process . stderr . fd ) ;
10
10
11
11
assert . doesNotThrow ( function ( ) {
12
12
process . once ( 'warning' , common . mustCall ( ( warning ) => {
@@ -35,28 +35,28 @@ global.process.stderr.write = function(string) {
35
35
errStrings . push ( string ) ;
36
36
} ;
37
37
38
- // test console.log()
38
+ // test console.log() goes to stdout
39
39
console . log ( 'foo' ) ;
40
40
console . log ( 'foo' , 'bar' ) ;
41
41
console . log ( '%s %s' , 'foo' , 'bar' , 'hop' ) ;
42
42
console . log ( { slashes : '\\\\' } ) ;
43
43
console . log ( custom_inspect ) ;
44
44
45
- // test console.info()
45
+ // test console.info() goes to stdout
46
46
console . info ( 'foo' ) ;
47
47
console . info ( 'foo' , 'bar' ) ;
48
48
console . info ( '%s %s' , 'foo' , 'bar' , 'hop' ) ;
49
49
console . info ( { slashes : '\\\\' } ) ;
50
50
console . info ( custom_inspect ) ;
51
51
52
- // test console.error()
52
+ // test console.error() goes to stderr
53
53
console . error ( 'foo' ) ;
54
54
console . error ( 'foo' , 'bar' ) ;
55
55
console . error ( '%s %s' , 'foo' , 'bar' , 'hop' ) ;
56
56
console . error ( { slashes : '\\\\' } ) ;
57
57
console . error ( custom_inspect ) ;
58
58
59
- // test console.warn()
59
+ // test console.warn() goes to stderr
60
60
console . warn ( 'foo' ) ;
61
61
console . warn ( 'foo' , 'bar' ) ;
62
62
console . warn ( '%s %s' , 'foo' , 'bar' , 'hop' ) ;
@@ -102,29 +102,31 @@ const expectedStrings = [
102
102
] ;
103
103
104
104
for ( const expected of expectedStrings ) {
105
- assert . equal ( expected + '\n' , strings . shift ( ) ) ; // console.log (stdout)
106
- assert . equal ( expected + '\n' , errStrings . shift ( ) ) ; // console.error (stderr)
105
+ assert . strictEqual ( expected + '\n' , strings . shift ( ) ) ;
106
+ assert . strictEqual ( expected + '\n' , errStrings . shift ( ) ) ;
107
107
}
108
108
109
109
for ( const expected of expectedStrings ) {
110
- assert . equal ( expected + '\n' , strings . shift ( ) ) ; // console.info (stdout)
111
- assert . equal ( expected + '\n' , errStrings . shift ( ) ) ; // console.warn (stderr)
110
+ assert . strictEqual ( expected + '\n' , strings . shift ( ) ) ;
111
+ assert . strictEqual ( expected + '\n' , errStrings . shift ( ) ) ;
112
112
}
113
113
114
- assert . equal ( "{ foo: 'bar', inspect: [Function: inspect] }\n" , strings . shift ( ) ) ;
115
- assert . equal ( "{ foo: 'bar', inspect: [Function: inspect] }\n" , strings . shift ( ) ) ;
114
+ assert . strictEqual ( "{ foo: 'bar', inspect: [Function: inspect] }\n" ,
115
+ strings . shift ( ) ) ;
116
+ assert . strictEqual ( "{ foo: 'bar', inspect: [Function: inspect] }\n" ,
117
+ strings . shift ( ) ) ;
116
118
assert . notEqual ( - 1 , strings . shift ( ) . indexOf ( 'foo: [Object]' ) ) ;
117
- assert . equal ( - 1 , strings . shift ( ) . indexOf ( 'baz' ) ) ;
119
+ assert . strictEqual ( - 1 , strings . shift ( ) . indexOf ( 'baz' ) ) ;
118
120
assert . ok ( / ^ l a b e l : \d + \. \d { 3 } m s $ / . test ( strings . shift ( ) . trim ( ) ) ) ;
119
121
assert . ok ( / ^ _ _ p r o t o _ _ : \d + \. \d { 3 } m s $ / . test ( strings . shift ( ) . trim ( ) ) ) ;
120
122
assert . ok ( / ^ c o n s t r u c t o r : \d + \. \d { 3 } m s $ / . test ( strings . shift ( ) . trim ( ) ) ) ;
121
123
assert . ok ( / ^ h a s O w n P r o p e r t y : \d + \. \d { 3 } m s $ / . test ( strings . shift ( ) . trim ( ) ) ) ;
122
124
123
- assert . equal ( 'Trace: This is a {"formatted":"trace"} 10 foo' ,
124
- errStrings . shift ( ) . split ( '\n' ) . shift ( ) ) ;
125
+ assert . strictEqual ( 'Trace: This is a {"formatted":"trace"} 10 foo' ,
126
+ errStrings . shift ( ) . split ( '\n' ) . shift ( ) ) ;
125
127
126
- assert . equal ( strings . length , 0 ) ;
127
- assert . equal ( errStrings . length , 0 ) ;
128
+ assert . strictEqual ( strings . length , 0 ) ;
129
+ assert . strictEqual ( errStrings . length , 0 ) ;
128
130
129
131
assert . throws ( ( ) => {
130
132
console . assert ( false , 'should throw' ) ;
0 commit comments