Updating NPM dependencies
This commit is contained in:
25
node_modules/expect/build/print.js
generated
vendored
25
node_modules/expect/build/print.js
generated
vendored
@@ -3,7 +3,7 @@
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.printReceivedConstructorNameNot = exports.printReceivedConstructorName = exports.printExpectedConstructorNameNot = exports.printExpectedConstructorName = exports.printReceivedArrayContainExpectedItem = exports.printReceivedStringContainExpectedResult = exports.printReceivedStringContainExpectedSubstring = void 0;
|
||||
exports.printReceivedConstructorNameNot = exports.printReceivedConstructorName = exports.printExpectedConstructorNameNot = exports.printExpectedConstructorName = exports.printCloseTo = exports.printReceivedArrayContainExpectedItem = exports.printReceivedStringContainExpectedResult = exports.printReceivedStringContainExpectedSubstring = void 0;
|
||||
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
|
||||
@@ -14,6 +14,8 @@ var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
/* eslint-disable local/ban-types-eventually */
|
||||
// Format substring but do not enclose in double quote marks.
|
||||
// The replacement is compatible with pretty-format package.
|
||||
const printSubstring = val => val.replace(/"|\\/g, '\\$&');
|
||||
@@ -60,6 +62,27 @@ const printReceivedArrayContainExpectedItem = (received, index) =>
|
||||
|
||||
exports.printReceivedArrayContainExpectedItem = printReceivedArrayContainExpectedItem;
|
||||
|
||||
const printCloseTo = (receivedDiff, expectedDiff, precision, isNot) => {
|
||||
const receivedDiffString = (0, _jestMatcherUtils.stringify)(receivedDiff);
|
||||
const expectedDiffString = receivedDiffString.includes('e') // toExponential arg is number of digits after the decimal point.
|
||||
? expectedDiff.toExponential(0)
|
||||
: 0 <= precision && precision < 20 // toFixed arg is number of digits after the decimal point.
|
||||
? // It may be a value between 0 and 20 inclusive.
|
||||
// Implementations may optionally support a larger range of values.
|
||||
expectedDiff.toFixed(precision + 1)
|
||||
: (0, _jestMatcherUtils.stringify)(expectedDiff);
|
||||
return (
|
||||
`Expected precision: ${isNot ? ' ' : ''} ${(0,
|
||||
_jestMatcherUtils.stringify)(precision)}\n` +
|
||||
`Expected difference: ${isNot ? 'not ' : ''}< ${(0,
|
||||
_jestMatcherUtils.EXPECTED_COLOR)(expectedDiffString)}\n` +
|
||||
`Received difference: ${isNot ? ' ' : ''} ${(0,
|
||||
_jestMatcherUtils.RECEIVED_COLOR)(receivedDiffString)}`
|
||||
);
|
||||
};
|
||||
|
||||
exports.printCloseTo = printCloseTo;
|
||||
|
||||
const printExpectedConstructorName = (label, expected) =>
|
||||
printConstructorName(label, expected, false, true) + '\n';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user