@@ -191,6 +191,12 @@ function getTruncatedDiffValue(lines) {
191191 return ArrayPrototypeJoin ( lines , '\n' ) ;
192192}
193193
194+ function hasLargeRootMismatch ( inspectedActual , inspectedExpected , diffType ) {
195+ return diffType !== 'full' &&
196+ inspectedActual . length + inspectedExpected . length > kMaxDiffLineCount &&
197+ inspectedActual [ 0 ] !== inspectedExpected [ 0 ] ;
198+ }
199+
194200function createErrDiff ( actual , expected , operator , customMessage , diffType = 'simple' ) {
195201 operator = checkOperator ( actual , expected , operator ) ;
196202
@@ -222,13 +228,16 @@ function createErrDiff(actual, expected, operator, customMessage, diffType = 'si
222228 message = ArrayPrototypeJoin ( inspectedSplitActual , '\n' ) ;
223229 }
224230 header = '' ;
225- } else if (
226- diffType !== 'full' &&
227- inspectedSplitActual . length + inspectedSplitExpected . length > kMaxDiffLineCount
228- ) {
229- message = `\n${ colors . green } + ${ colors . white } ${ getTruncatedDiffValue ( inspectedSplitActual ) } \n` +
231+ } else if ( hasLargeRootMismatch ( inspectedSplitActual , inspectedSplitExpected , diffType ) ) {
232+ const actualPrefix = operator === 'partialDeepStrictEqual' ?
233+ ` ${ colors . gray } ${ colors . hasColors ? ' ' : '+' } ` :
234+ ` ${ colors . green } + ${ colors . white } ` ;
235+ message = `\n${ actualPrefix } ${ getTruncatedDiffValue ( inspectedSplitActual ) } \n` +
230236 `${ colors . red } -${ colors . white } ${ getTruncatedDiffValue ( inspectedSplitExpected ) } ` ;
231237 skipped = true ;
238+ if ( operator === 'partialDeepStrictEqual' ) {
239+ header = `${ colors . gray } ${ colors . hasColors ? '' : '+ ' } actual${ colors . white } ${ colors . red } - expected${ colors . white } ` ;
240+ }
232241 } else {
233242 const checkCommaDisparity = actual != null && typeof actual === 'object' ;
234243 const diff = myersDiff ( inspectedSplitActual , inspectedSplitExpected , checkCommaDisparity ) ;
0 commit comments