@@ -770,23 +770,25 @@ assert.strictEqual(util.inspect(-5e-324), '-5e-324');
770770// Note: Symbols are not supported by `Error#toString()` which is called by
771771// accessing the `stack` property.
772772[
773- [ 404 , '404 [RangeError]: foo' , '[404]' ] ,
773+ // [404, '404 [RangeError]: foo', '[404]'],
774774 [ 0 , '0 [RangeError]: foo' , '[RangeError: foo]' ] ,
775775 [ 0n , '0 [RangeError]: foo' , '[RangeError: foo]' ] ,
776776 [ null , 'null: foo' , '[RangeError: foo]' ] ,
777777 [ undefined , 'RangeError: foo' , '[RangeError: foo]' ] ,
778778 [ false , 'false [RangeError]: foo' , '[RangeError: foo]' ] ,
779779 [ '' , 'foo' , '[RangeError: foo]' ] ,
780- [ [ 1 , 2 , 3 ] , '1,2,3 [RangeError]: foo' , '[1,2,3 ]' ] ,
780+ [ [ 1 , 2 , 3 ] , '1,2,3 [RangeError]: foo' , '[[\n 1,\n 2,\n 3\n] ]' ] ,
781781] . forEach ( ( [ value , outputStart , stack ] ) => {
782782 let err = new RangeError ( 'foo' ) ;
783783 err . name = value ;
784+ const result = util . inspect ( err ) ;
784785 assert (
785- util . inspect ( err ) . startsWith ( outputStart ) ,
786+ result . startsWith ( outputStart ) ,
786787 util . format (
787- 'The name set to %o did not result in the expected output "%s"' ,
788+ 'The name set to %o did not result in the expected output "%s", got "%s" ' ,
788789 value ,
789- outputStart
790+ outputStart ,
791+ result . split ( '\n' ) [ 0 ]
790792 )
791793 ) ;
792794
@@ -3448,3 +3450,13 @@ assert.strictEqual(
34483450${ error . stack . split ( '\n' ) . slice ( 1 ) . join ( '\n' ) } `,
34493451 ) ;
34503452}
3453+
3454+ {
3455+ const error = new Error ( ) ;
3456+ error . stack = [ Symbol ( 'foo' ) ] ;
3457+
3458+ assert . strictEqual (
3459+ inspect ( error ) ,
3460+ '[[\n Symbol(foo)\n]]'
3461+ ) ;
3462+ }
0 commit comments