@@ -5,8 +5,8 @@ const assert = require('assert');
55assert . ok ( process . stdout . writable ) ;
66assert . ok ( process . stderr . writable ) ;
77// 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 ) ;
1010
1111assert . doesNotThrow ( function ( ) {
1212 process . once ( 'warning' , common . mustCall ( ( warning ) => {
@@ -35,28 +35,28 @@ global.process.stderr.write = function(string) {
3535 errStrings . push ( string ) ;
3636} ;
3737
38- // test console.log()
38+ // test console.log() goes to stdout
3939console . log ( 'foo' ) ;
4040console . log ( 'foo' , 'bar' ) ;
4141console . log ( '%s %s' , 'foo' , 'bar' , 'hop' ) ;
4242console . log ( { slashes : '\\\\' } ) ;
4343console . log ( custom_inspect ) ;
4444
45- // test console.info()
45+ // test console.info() goes to stdout
4646console . info ( 'foo' ) ;
4747console . info ( 'foo' , 'bar' ) ;
4848console . info ( '%s %s' , 'foo' , 'bar' , 'hop' ) ;
4949console . info ( { slashes : '\\\\' } ) ;
5050console . info ( custom_inspect ) ;
5151
52- // test console.error()
52+ // test console.error() goes to stderr
5353console . error ( 'foo' ) ;
5454console . error ( 'foo' , 'bar' ) ;
5555console . error ( '%s %s' , 'foo' , 'bar' , 'hop' ) ;
5656console . error ( { slashes : '\\\\' } ) ;
5757console . error ( custom_inspect ) ;
5858
59- // test console.warn()
59+ // test console.warn() goes to stderr
6060console . warn ( 'foo' ) ;
6161console . warn ( 'foo' , 'bar' ) ;
6262console . warn ( '%s %s' , 'foo' , 'bar' , 'hop' ) ;
@@ -102,29 +102,31 @@ const expectedStrings = [
102102] ;
103103
104104for ( 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 ( ) ) ;
107107}
108108
109109for ( 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 ( ) ) ;
112112}
113113
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 ( ) ) ;
116118assert . notEqual ( - 1 , strings . shift ( ) . indexOf ( 'foo: [Object]' ) ) ;
117- assert . equal ( - 1 , strings . shift ( ) . indexOf ( 'baz' ) ) ;
119+ assert . strictEqual ( - 1 , strings . shift ( ) . indexOf ( 'baz' ) ) ;
118120assert . ok ( / ^ l a b e l : \d + \. \d { 3 } m s $ / . test ( strings . shift ( ) . trim ( ) ) ) ;
119121assert . ok ( / ^ _ _ p r o t o _ _ : \d + \. \d { 3 } m s $ / . test ( strings . shift ( ) . trim ( ) ) ) ;
120122assert . ok ( / ^ c o n s t r u c t o r : \d + \. \d { 3 } m s $ / . test ( strings . shift ( ) . trim ( ) ) ) ;
121123assert . ok ( / ^ h a s O w n P r o p e r t y : \d + \. \d { 3 } m s $ / . test ( strings . shift ( ) . trim ( ) ) ) ;
122124
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 ( ) ) ;
125127
126- assert . equal ( strings . length , 0 ) ;
127- assert . equal ( errStrings . length , 0 ) ;
128+ assert . strictEqual ( strings . length , 0 ) ;
129+ assert . strictEqual ( errStrings . length , 0 ) ;
128130
129131assert . throws ( ( ) => {
130132 console . assert ( false , 'should throw' ) ;
0 commit comments