@@ -10,6 +10,9 @@ const { AssertionError } = assert;
1010const defaultMsgStart = 'Expected values to be strictly deep-equal:\n' ;
1111const defaultMsgStartFull = `${ defaultMsgStart } + actual - expected` ;
1212
13+ const objectEntries = require ( 'object.entries' ) ;
14+ const arrayFrom = require ( 'array-from' ) ;
15+
1316// Disable colored output to prevent color codes from breaking assertion
1417// message comparisons. This should only be an issue when process.stdout
1518// is a TTY.
@@ -20,7 +23,7 @@ if (process.stdout && process.stdout.isTTY)
2023// for assert.throws()
2124function re ( literals , ...values ) {
2225 let result = 'Expected values to be loosely deep-equal:\n\n' ;
23- for ( const [ i , value ] of values . entries ( ) ) {
26+ arrayFrom ( values . entries ( ) ) . forEach ( ( [ i , value ] ) => {
2427 const str = util . inspect ( value , {
2528 compact : false ,
2629 depth : 1000 ,
@@ -33,7 +36,7 @@ function re(literals, ...values) {
3336 // Need to escape special characters.
3437 result += str ;
3538 result += literals [ i + 1 ] ;
36- }
39+ } ) ;
3740 return {
3841 code : 'ERR_ASSERTION' ,
3942 message : result
@@ -174,17 +177,17 @@ assert.throws(
174177 ( function ( ) { return arguments ; } ) ( 1 )
175178 ] ) ;
176179
177- for ( const a of similar ) {
178- for ( const b of similar ) {
180+ arrayFrom ( similar ) . forEach ( a => {
181+ arrayFrom ( similar ) . forEach ( b => {
179182 if ( a !== b ) {
180183 assert . notDeepEqual ( a , b ) ;
181184 assert . throws (
182185 ( ) => assert . deepStrictEqual ( a , b ) ,
183186 { code : 'ERR_ASSERTION' }
184187 ) ;
185188 }
186- }
187- }
189+ } ) ;
190+ } ) ;
188191}
189192
190193function assertDeepAndStrictEqual ( a , b ) {
0 commit comments