expect
Advanced tools
Comparing version 28.0.0-alpha.5 to 28.0.0-alpha.6
@@ -208,3 +208,3 @@ 'use strict'; | ||
toAsymmetricMatcher() { | ||
return 'Any<' + fnNameFor(this.sample) + '>'; | ||
return `Any<${fnNameFor(this.sample)}>`; | ||
} | ||
@@ -235,5 +235,4 @@ } | ||
throw new Error( | ||
`You must provide an array to ${this.toString()}, not '` + | ||
typeof this.sample + | ||
"'." | ||
`You must provide an array to ${this.toString()}, not '${typeof this | ||
.sample}'.` | ||
); | ||
@@ -268,5 +267,4 @@ } | ||
throw new Error( | ||
`You must provide an object to ${this.toString()}, not '` + | ||
typeof this.sample + | ||
"'." | ||
`You must provide an object to ${this.toString()}, not '${typeof this | ||
.sample}'.` | ||
); | ||
@@ -273,0 +271,0 @@ } |
@@ -47,16 +47,14 @@ 'use strict'; | ||
expectedAssertionsNumberError.message = | ||
(0, _jestMatcherUtils.matcherHint)( | ||
`${(0, _jestMatcherUtils.matcherHint)( | ||
'.assertions', | ||
'', | ||
String(expectedAssertionsNumber), | ||
expectedAssertionsNumber.toString(), | ||
{ | ||
isDirectExpectCall: true | ||
} | ||
) + | ||
'\n\n' + | ||
`Expected ${numOfAssertionsExpected} to be called but received ` + | ||
(0, _jestMatcherUtils.RECEIVED_COLOR)( | ||
)}\n\n` + | ||
`Expected ${numOfAssertionsExpected} to be called but received ${(0, | ||
_jestMatcherUtils.RECEIVED_COLOR)( | ||
(0, _jestMatcherUtils.pluralize)('assertion call', assertionCalls || 0) | ||
) + | ||
'.'; | ||
)}.`; | ||
result.push({ | ||
@@ -74,8 +72,10 @@ actual: assertionCalls.toString(), | ||
const received = (0, _jestMatcherUtils.RECEIVED_COLOR)('received none'); | ||
isExpectingAssertionsError.message = | ||
(0, _jestMatcherUtils.matcherHint)('.hasAssertions', '', '', { | ||
isExpectingAssertionsError.message = `${(0, _jestMatcherUtils.matcherHint)( | ||
'.hasAssertions', | ||
'', | ||
'', | ||
{ | ||
isDirectExpectCall: true | ||
}) + | ||
'\n\n' + | ||
`Expected ${expected} to be called but ${received}.`; | ||
} | ||
)}\n\nExpected ${expected} to be called but ${received}.`; | ||
result.push({ | ||
@@ -82,0 +82,0 @@ actual: 'none', |
@@ -197,4 +197,8 @@ 'use strict'; | ||
outerErr.message = | ||
matcherUtils.matcherHint(matcherName, undefined, '', options) + | ||
'\n\n' + | ||
`${matcherUtils.matcherHint( | ||
matcherName, | ||
undefined, | ||
'', | ||
options | ||
)}\n\n` + | ||
'Received promise rejected instead of resolved\n' + | ||
@@ -236,4 +240,8 @@ `Rejected to value: ${matcherUtils.printReceived(reason)}`; | ||
outerErr.message = | ||
matcherUtils.matcherHint(matcherName, undefined, '', options) + | ||
'\n\n' + | ||
`${matcherUtils.matcherHint( | ||
matcherName, | ||
undefined, | ||
'', | ||
options | ||
)}\n\n` + | ||
'Received promise resolved instead of rejected\n' + | ||
@@ -240,0 +248,0 @@ `Resolved to value: ${matcherUtils.printReceived(result)}`; |
@@ -50,2 +50,3 @@ 'use strict'; | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -85,2 +86,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -94,5 +96,5 @@ matcherName, | ||
(deepEqualityName !== null | ||
? (0, _jestMatcherUtils.DIM_COLOR)( | ||
? `${(0, _jestMatcherUtils.DIM_COLOR)( | ||
`If it should pass with deep equality, replace "${matcherName}" with "${deepEqualityName}"` | ||
) + '\n\n' | ||
)}\n\n` | ||
: '') + | ||
@@ -189,2 +191,3 @@ (0, _jestMatcherUtils.printDiffOrStringify)( | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -203,4 +206,3 @@ matcherName, | ||
)}\n` + | ||
'\n' + | ||
(0, _print.printCloseTo)( | ||
`\n${(0, _print.printCloseTo)( | ||
receivedDiff, | ||
@@ -210,4 +212,5 @@ expectedDiff, | ||
isNot | ||
)) | ||
)}`) | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -245,2 +248,3 @@ matcherName, | ||
const message = () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + | ||
@@ -266,2 +270,3 @@ '\n\n' + | ||
const message = () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + | ||
@@ -293,2 +298,3 @@ '\n\n' + | ||
const message = () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -330,2 +336,3 @@ matcherName, | ||
const message = () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -380,2 +387,3 @@ matcherName, | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -401,2 +409,3 @@ matcherName, | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -447,2 +456,3 @@ matcherName, | ||
const message = () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -484,2 +494,3 @@ matcherName, | ||
const message = () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -513,2 +524,3 @@ matcherName, | ||
const message = () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + | ||
@@ -534,2 +546,3 @@ '\n\n' + | ||
const message = () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + | ||
@@ -555,2 +568,3 @@ '\n\n' + | ||
const message = () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + | ||
@@ -576,2 +590,3 @@ '\n\n' + | ||
const message = () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + | ||
@@ -633,3 +648,3 @@ '\n\n' + | ||
), | ||
wrongTypeErrorMessage, | ||
wrongTypeErrorMessage, // eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.printWithType)( | ||
@@ -663,2 +678,3 @@ 'Expected', | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -703,2 +719,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -778,2 +795,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -814,2 +832,3 @@ matcherName, | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -828,2 +847,3 @@ matcherName, | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -907,2 +927,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -1025,2 +1046,3 @@ matcherName, | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -1039,9 +1061,9 @@ matcherName, | ||
expectedValue | ||
)}` + | ||
((0, _jestMatcherUtils.stringify)(expectedValue) !== | ||
(0, _jestMatcherUtils.stringify)(receivedValue) | ||
? `\nReceived value: ${(0, _jestMatcherUtils.printReceived)( | ||
receivedValue | ||
)}` | ||
: '') | ||
)}${ | ||
(0, _jestMatcherUtils.stringify)(expectedValue) !== | ||
(0, _jestMatcherUtils.stringify)(receivedValue) | ||
? `\nReceived value: ${(0, | ||
_jestMatcherUtils.printReceived)(receivedValue)}` | ||
: '' | ||
}` | ||
: `Expected path: not ${(0, _jestMatcherUtils.printExpected)( | ||
@@ -1054,2 +1076,3 @@ expectedPath | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -1066,4 +1089,3 @@ matcherName, | ||
(hasCompletePath | ||
? '\n' + | ||
(0, _jestMatcherUtils.printDiffOrStringify)( | ||
? `\n${(0, _jestMatcherUtils.printDiffOrStringify)( | ||
expectedValue, | ||
@@ -1074,3 +1096,3 @@ receivedValue, | ||
isExpand(this.expand) | ||
) | ||
)}` | ||
: `Received path: ${(0, _jestMatcherUtils.printReceived)( | ||
@@ -1080,9 +1102,9 @@ expectedPathType === 'array' || receivedPath.length === 0 | ||
: receivedPath.join('.') | ||
)}\n\n` + | ||
(hasValue | ||
? `Expected value: ${(0, _jestMatcherUtils.printExpected)( | ||
expectedValue | ||
)}\n` | ||
: '') + | ||
`Received value: ${(0, _jestMatcherUtils.printReceived)( | ||
)}\n\n${ | ||
hasValue | ||
? `Expected value: ${(0, _jestMatcherUtils.printExpected)( | ||
expectedValue | ||
)}\n` | ||
: '' | ||
}Received value: ${(0, _jestMatcherUtils.printReceived)( | ||
receivedValue | ||
@@ -1154,3 +1176,3 @@ )}`); | ||
? () => | ||
typeof expected === 'string' | ||
typeof expected === 'string' // eslint-disable-next-line prefer-template | ||
? (0, _jestMatcherUtils.matcherHint)( | ||
@@ -1171,3 +1193,3 @@ matcherName, | ||
expected.length | ||
)}` | ||
)}` // eslint-disable-next-line prefer-template | ||
: (0, _jestMatcherUtils.matcherHint)( | ||
@@ -1200,2 +1222,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -1277,2 +1300,3 @@ matcherName, | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -1293,2 +1317,3 @@ matcherName, | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -1329,2 +1354,3 @@ matcherName, | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -1343,2 +1369,3 @@ matcherName, | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -1345,0 +1372,0 @@ matcherName, |
@@ -37,9 +37,6 @@ 'use strict'; | ||
(0, _jestMatcherUtils.RECEIVED_COLOR)( | ||
'"' + | ||
printSubstring(received.slice(0, start)) + | ||
(0, _jestMatcherUtils.INVERTED_COLOR)( | ||
printSubstring(received.slice(start, start + length)) | ||
) + | ||
printSubstring(received.slice(start + length)) + | ||
'"' | ||
`"${printSubstring(received.slice(0, start))}${(0, | ||
_jestMatcherUtils.INVERTED_COLOR)( | ||
printSubstring(received.slice(start, start + length)) | ||
)}${printSubstring(received.slice(start + length))}"` | ||
); | ||
@@ -66,12 +63,10 @@ | ||
(0, _jestMatcherUtils.RECEIVED_COLOR)( | ||
'[' + | ||
received | ||
.map((item, i) => { | ||
const stringified = (0, _jestMatcherUtils.stringify)(item); | ||
return i === index | ||
? (0, _jestMatcherUtils.INVERTED_COLOR)(stringified) | ||
: stringified; | ||
}) | ||
.join(', ') + | ||
']' | ||
`[${received | ||
.map((item, i) => { | ||
const stringified = (0, _jestMatcherUtils.stringify)(item); | ||
return i === index | ||
? (0, _jestMatcherUtils.INVERTED_COLOR)(stringified) | ||
: stringified; | ||
}) | ||
.join(', ')}]` | ||
); | ||
@@ -104,3 +99,3 @@ | ||
const printExpectedConstructorName = (label, expected) => | ||
printConstructorName(label, expected, false, true) + '\n'; | ||
`${printConstructorName(label, expected, false, true)}\n`; | ||
@@ -110,3 +105,3 @@ exports.printExpectedConstructorName = printExpectedConstructorName; | ||
const printExpectedConstructorNameNot = (label, expected) => | ||
printConstructorName(label, expected, true, true) + '\n'; | ||
`${printConstructorName(label, expected, true, true)}\n`; | ||
@@ -116,3 +111,3 @@ exports.printExpectedConstructorNameNot = printExpectedConstructorNameNot; | ||
const printReceivedConstructorName = (label, received) => | ||
printConstructorName(label, received, false, false) + '\n'; // Do not call function if received is equal to expected. | ||
`${printConstructorName(label, received, false, false)}\n`; // Do not call function if received is equal to expected. | ||
@@ -126,10 +121,8 @@ exports.printReceivedConstructorName = printReceivedConstructorName; | ||
received.name.length !== 0 | ||
? printConstructorName(label, received, true, false) + | ||
` ${ | ||
? `${printConstructorName(label, received, true, false)} ${ | ||
Object.getPrototypeOf(received) === expected | ||
? 'extends' | ||
: 'extends … extends' | ||
} ${(0, _jestMatcherUtils.EXPECTED_COLOR)(expected.name)}` + | ||
'\n' | ||
: printConstructorName(label, received, false, false) + '\n'; | ||
} ${(0, _jestMatcherUtils.EXPECTED_COLOR)(expected.name)}\n` | ||
: `${printConstructorName(label, received, false, false)}\n`; | ||
@@ -136,0 +129,0 @@ exports.printReceivedConstructorNameNot = printReceivedConstructorNameNot; |
@@ -59,6 +59,9 @@ 'use strict'; | ||
const printNumberOfReturns = (countReturns, countCalls) => | ||
`\nNumber of returns: ${(0, _jestMatcherUtils.printReceived)(countReturns)}` + | ||
(countCalls !== countReturns | ||
? `\nNumber of calls: ${(0, _jestMatcherUtils.printReceived)(countCalls)}` | ||
: ''); | ||
`\nNumber of returns: ${(0, _jestMatcherUtils.printReceived)(countReturns)}${ | ||
countCalls !== countReturns | ||
? `\nNumber of calls: ${(0, _jestMatcherUtils.printReceived)( | ||
countCalls | ||
)}` | ||
: '' | ||
}`; | ||
@@ -73,3 +76,3 @@ // Given a label, return a function which given a string, | ||
(isExpectedCall | ||
? '->' + ' '.repeat(Math.max(0, index - 2 - string.length)) | ||
? `->${' '.repeat(Math.max(0, index - 2 - string.length))}` | ||
: ' '.repeat(Math.max(index - string.length))) + | ||
@@ -93,17 +96,15 @@ string + | ||
if (isOnlyCall) { | ||
return label + printReceivedArgs(indexedCalls[0], expected) + '\n'; | ||
return `${label + printReceivedArgs(indexedCalls[0], expected)}\n`; | ||
} | ||
const printAligned = getRightAlignedPrinter(label); | ||
return ( | ||
'Received\n' + | ||
indexedCalls.reduce( | ||
(printed, [i, args]) => | ||
return `Received\n${indexedCalls.reduce( | ||
(printed, [i, args]) => | ||
`${ | ||
printed + | ||
printAligned(String(i + 1), i === iExpectedCall) + | ||
printReceivedArgs(args, expected) + | ||
'\n', | ||
'' | ||
) | ||
); | ||
printReceivedArgs(args, expected) | ||
}\n`, | ||
'' | ||
)}`; | ||
}; | ||
@@ -160,3 +161,3 @@ | ||
// Omit annotation in case multiple args have diff. | ||
lines.push(difference.split('\n').slice(3).join('\n') + ','); | ||
lines.push(`${difference.split('\n').slice(3).join('\n')},`); | ||
continue; | ||
@@ -169,5 +170,5 @@ } | ||
lines.push( | ||
(0, _jestMatcherUtils.EXPECTED_COLOR)( | ||
'- ' + (0, _jestMatcherUtils.stringify)(expected[i]) | ||
) + ',' | ||
`${(0, _jestMatcherUtils.EXPECTED_COLOR)( | ||
`- ${(0, _jestMatcherUtils.stringify)(expected[i])}` | ||
)},` | ||
); | ||
@@ -178,5 +179,5 @@ } | ||
lines.push( | ||
(0, _jestMatcherUtils.RECEIVED_COLOR)( | ||
'+ ' + (0, _jestMatcherUtils.stringify)(received[i]) | ||
) + ',' | ||
`${(0, _jestMatcherUtils.RECEIVED_COLOR)( | ||
`+ ${(0, _jestMatcherUtils.stringify)(received[i])}` | ||
)},` | ||
); | ||
@@ -186,6 +187,6 @@ } | ||
return lines.join('\n') + '\n'; | ||
return `${lines.join('\n')}\n`; | ||
} | ||
return expectedLine + label + printReceivedArgs(received, expected) + '\n'; | ||
return `${expectedLine + label + printReceivedArgs(received, expected)}\n`; | ||
} | ||
@@ -195,2 +196,3 @@ | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
expectedLine + | ||
@@ -200,3 +202,3 @@ 'Received\n' + | ||
const aligned = printAligned(String(i + 1), i === iExpectedCall); | ||
return ( | ||
return `${ | ||
printed + | ||
@@ -207,5 +209,4 @@ ((i === iExpectedCall || iExpectedCall === undefined) && | ||
printDiffCall(expected, received, expand) | ||
: aligned + printReceivedArgs(received, expected)) + | ||
'\n' | ||
); | ||
: aligned + printReceivedArgs(received, expected)) | ||
}\n`; | ||
}, '') | ||
@@ -222,3 +223,3 @@ ); | ||
if (isEqualValue(expected[i], arg)) { | ||
return indentation + ' ' + printCommon(arg) + ','; | ||
return `${indentation} ${printCommon(arg)},`; | ||
} | ||
@@ -238,9 +239,7 @@ | ||
// Omit annotation in case multiple args have diff. | ||
return ( | ||
difference | ||
.split('\n') | ||
.slice(3) | ||
.map(line => indentation + line) | ||
.join('\n') + ',' | ||
); | ||
return `${difference | ||
.split('\n') | ||
.slice(3) | ||
.map(line => indentation + line) | ||
.join('\n')},`; | ||
} | ||
@@ -250,11 +249,10 @@ } | ||
return ( | ||
return `${ | ||
indentation + | ||
(i < expected.length | ||
? ' ' + (0, _jestMatcherUtils.printReceived)(arg) | ||
? ` ${(0, _jestMatcherUtils.printReceived)(arg)}` | ||
: (0, _jestMatcherUtils.RECEIVED_COLOR)( | ||
'+ ' + (0, _jestMatcherUtils.stringify)(arg) | ||
)) + | ||
',' | ||
); | ||
`+ ${(0, _jestMatcherUtils.stringify)(arg)}` | ||
)) | ||
},`; | ||
}) | ||
@@ -333,3 +331,3 @@ .join('\n'); | ||
if (isOnlyCall && (iExpectedCall === 0 || iExpectedCall === undefined)) { | ||
return label + printResult(indexedResults[0][1], expected) + '\n'; | ||
return `${label + printResult(indexedResults[0][1], expected)}\n`; | ||
} | ||
@@ -339,2 +337,3 @@ | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
label.replace(':', '').trim() + | ||
@@ -344,6 +343,7 @@ '\n' + | ||
(printed, [i, result]) => | ||
printed + | ||
printAligned(String(i + 1), i === iExpectedCall) + | ||
printResult(result, expected) + | ||
'\n', | ||
`${ | ||
printed + | ||
printAligned(String(i + 1), i === iExpectedCall) + | ||
printResult(result, expected) | ||
}\n`, | ||
'' | ||
@@ -374,2 +374,3 @@ ) | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -398,2 +399,3 @@ matcherName, | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -436,2 +438,3 @@ matcherName, | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -468,2 +471,3 @@ matcherName, | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -511,2 +515,3 @@ matcherName, | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -523,2 +528,3 @@ matcherName, | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -565,2 +571,3 @@ matcherName, | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -580,2 +587,3 @@ matcherName, | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -633,2 +641,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -667,2 +676,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -718,2 +728,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -754,2 +765,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -804,2 +816,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -850,2 +863,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -899,2 +913,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -947,2 +962,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -1027,2 +1043,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -1105,2 +1122,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -1184,2 +1202,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -1264,2 +1283,3 @@ matcherName, | ||
return ( | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -1266,0 +1286,0 @@ matcherName, |
@@ -137,2 +137,3 @@ 'use strict'; | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -155,2 +156,3 @@ matcherName, | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -165,3 +167,3 @@ matcherName, | ||
(thrown === null | ||
? '\n' + DID_NOT_THROW | ||
? `\n${DID_NOT_THROW}` | ||
: thrown.hasMessage | ||
@@ -181,2 +183,3 @@ ? formatReceived('Received message: ', thrown, 'message') + | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -197,2 +200,3 @@ matcherName, | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -224,2 +228,3 @@ matcherName, | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -237,2 +242,3 @@ matcherName, | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -245,7 +251,7 @@ matcherName, | ||
'\n\n' + | ||
(thrown === null | ||
(thrown === null // eslint-disable-next-line prefer-template | ||
? formatExpected('Expected message: ', expected.message) + | ||
'\n' + | ||
DID_NOT_THROW | ||
: thrown.hasMessage | ||
: thrown.hasMessage // eslint-disable-next-line prefer-template | ||
? (0, _jestMatcherUtils.printDiffOrStringify)( | ||
@@ -272,2 +278,3 @@ expected.message, | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -300,2 +307,3 @@ matcherName, | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -313,15 +321,17 @@ matcherName, | ||
(thrown === null | ||
? '\n' + DID_NOT_THROW | ||
: (thrown.value != null && | ||
typeof thrown.value.constructor === 'function' | ||
? (0, _print.printReceivedConstructorName)( | ||
'Received constructor', | ||
thrown.value.constructor | ||
) | ||
: '') + | ||
'\n' + | ||
(thrown.hasMessage | ||
? formatReceived('Received message: ', thrown, 'message') + | ||
formatStack(thrown) | ||
: formatReceived('Received value: ', thrown, 'value'))); | ||
? `\n${DID_NOT_THROW}` | ||
: `${ | ||
thrown.value != null && | ||
typeof thrown.value.constructor === 'function' | ||
? (0, _print.printReceivedConstructorName)( | ||
'Received constructor', | ||
thrown.value.constructor | ||
) | ||
: '' | ||
}\n${ | ||
thrown.hasMessage | ||
? formatReceived('Received message: ', thrown, 'message') + | ||
formatStack(thrown) | ||
: formatReceived('Received value: ', thrown, 'value') | ||
}`); | ||
return { | ||
@@ -337,2 +347,3 @@ message, | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -355,2 +366,3 @@ matcherName, | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -365,3 +377,3 @@ matcherName, | ||
(thrown === null | ||
? '\n' + DID_NOT_THROW | ||
? `\n${DID_NOT_THROW}` | ||
: thrown.hasMessage | ||
@@ -381,2 +393,3 @@ ? formatReceived('Received message: ', thrown, 'message') + | ||
? () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -395,2 +408,3 @@ matcherName, | ||
: () => | ||
// eslint-disable-next-line prefer-template | ||
(0, _jestMatcherUtils.matcherHint)( | ||
@@ -411,3 +425,3 @@ matcherName, | ||
const formatExpected = (label, expected) => | ||
label + (0, _jestMatcherUtils.printExpected)(expected) + '\n'; | ||
`${label + (0, _jestMatcherUtils.printExpected)(expected)}\n`; | ||
@@ -426,3 +440,3 @@ const formatReceived = (label, thrown, key, expected) => { | ||
if (index !== -1) { | ||
return ( | ||
return `${ | ||
label + | ||
@@ -433,8 +447,7 @@ (0, _print.printReceivedStringContainExpectedSubstring)( | ||
expected.length | ||
) + | ||
'\n' | ||
); | ||
) | ||
}\n`; | ||
} | ||
} else if (expected instanceof RegExp) { | ||
return ( | ||
return `${ | ||
label + | ||
@@ -444,8 +457,7 @@ (0, _print.printReceivedStringContainExpectedResult)( | ||
typeof expected.exec === 'function' ? expected.exec(message) : null | ||
) + | ||
'\n' | ||
); | ||
) | ||
}\n`; | ||
} | ||
return label + (0, _jestMatcherUtils.printReceived)(message) + '\n'; | ||
return `${label + (0, _jestMatcherUtils.printReceived)(message)}\n`; | ||
} | ||
@@ -455,3 +467,3 @@ | ||
return thrown.isError | ||
? label + (0, _jestMatcherUtils.printReceived)(thrown.value.name) + '\n' | ||
? `${label + (0, _jestMatcherUtils.printReceived)(thrown.value.name)}\n` | ||
: ''; | ||
@@ -463,3 +475,3 @@ } | ||
? '' | ||
: label + (0, _jestMatcherUtils.printReceived)(thrown.value) + '\n'; | ||
: `${label + (0, _jestMatcherUtils.printReceived)(thrown.value)}\n`; | ||
} | ||
@@ -466,0 +478,0 @@ |
{ | ||
"name": "expect", | ||
"version": "28.0.0-alpha.5", | ||
"version": "28.0.0-alpha.6", | ||
"repository": { | ||
@@ -21,9 +21,9 @@ "type": "git", | ||
"dependencies": { | ||
"@jest/expect-utils": "^28.0.0-alpha.5", | ||
"@jest/expect-utils": "^28.0.0-alpha.6", | ||
"jest-get-type": "^28.0.0-alpha.3", | ||
"jest-matcher-utils": "^28.0.0-alpha.5", | ||
"jest-message-util": "^28.0.0-alpha.5" | ||
"jest-matcher-utils": "^28.0.0-alpha.6", | ||
"jest-message-util": "^28.0.0-alpha.6" | ||
}, | ||
"devDependencies": { | ||
"@jest/test-utils": "^28.0.0-alpha.5", | ||
"@jest/test-utils": "^28.0.0-alpha.6", | ||
"@tsd/typescript": "~4.5.5", | ||
@@ -41,3 +41,3 @@ "chalk": "^4.0.0", | ||
}, | ||
"gitHead": "46fb19b2628bd87676c10730ba19592c30b05478" | ||
"gitHead": "6284ada4adb7008f5f8673b1a7b1c789d2e508fb" | ||
} |
141929
4270