mirror of
https://github.com/actions/labeler.git
synced 2025-12-17 15:46:44 +00:00
build
This commit is contained in:
108
node_modules/expect/build/print.js
generated
vendored
108
node_modules/expect/build/print.js
generated
vendored
@@ -3,39 +3,10 @@
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.printReceivedConstructorNameNot = exports.printReceivedConstructorName = exports.printExpectedConstructorNameNot = exports.printExpectedConstructorName = exports.printDiffOrStringify = exports.printReceivedArrayContainExpectedItem = exports.printReceivedStringContainExpectedResult = exports.printReceivedStringContainExpectedSubstring = void 0;
|
||||
|
||||
var _jestGetType = _interopRequireWildcard(require('jest-get-type'));
|
||||
exports.printReceivedConstructorNameNot = exports.printReceivedConstructorName = exports.printExpectedConstructorNameNot = exports.printExpectedConstructorName = exports.printReceivedArrayContainExpectedItem = exports.printReceivedStringContainExpectedResult = exports.printReceivedStringContainExpectedSubstring = void 0;
|
||||
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
} else {
|
||||
var newObj = {};
|
||||
if (obj != null) {
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: {};
|
||||
if (desc.get || desc.set) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
return newObj;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
@@ -89,83 +60,6 @@ const printReceivedArrayContainExpectedItem = (received, index) =>
|
||||
|
||||
exports.printReceivedArrayContainExpectedItem = printReceivedArrayContainExpectedItem;
|
||||
|
||||
const shouldPrintDiff = (expected, received) => {
|
||||
const expectedType = (0, _jestGetType.default)(expected);
|
||||
const receivedType = (0, _jestGetType.default)(received);
|
||||
|
||||
if (expectedType !== receivedType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((0, _jestGetType.isPrimitive)(expected)) {
|
||||
// Print diff only if both strings have more than one line.
|
||||
return (
|
||||
expectedType === 'string' && !(0, _utils.isOneline)(expected, received)
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
expectedType === 'date' ||
|
||||
expectedType === 'function' ||
|
||||
expectedType === 'regexp'
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (expected instanceof Error && received instanceof Error) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const printDiffOrStringify = (
|
||||
expected,
|
||||
received,
|
||||
expectedLabel,
|
||||
receivedLabel,
|
||||
expand
|
||||
) => {
|
||||
// Cannot use same serialization as shortcut to avoid diff,
|
||||
// because stringify (that is, pretty-format with min option)
|
||||
// omits constructor name for array or object, too bad so sad :(
|
||||
const difference = shouldPrintDiff(expected, received)
|
||||
? (0, _jestMatcherUtils.diff)(expected, received, {
|
||||
aAnnotation: expectedLabel,
|
||||
bAnnotation: receivedLabel,
|
||||
expand
|
||||
}) // string | null
|
||||
: null; // Cannot reuse value of stringify(received) in report string,
|
||||
// because printReceived does inverse highlight space at end of line,
|
||||
// but RECEIVED_COLOR does not (it refers to a plain chalk method).
|
||||
|
||||
if (
|
||||
typeof difference === 'string' &&
|
||||
difference.includes('- ' + expectedLabel) &&
|
||||
difference.includes('+ ' + receivedLabel)
|
||||
) {
|
||||
return difference;
|
||||
}
|
||||
|
||||
const printLabel = (0, _jestMatcherUtils.getLabelPrinter)(
|
||||
expectedLabel,
|
||||
receivedLabel
|
||||
);
|
||||
return (
|
||||
`${printLabel(expectedLabel)}${(0, _jestMatcherUtils.printExpected)(
|
||||
expected
|
||||
)}\n` +
|
||||
`${printLabel(receivedLabel)}${
|
||||
(0, _jestMatcherUtils.stringify)(expected) ===
|
||||
(0, _jestMatcherUtils.stringify)(received)
|
||||
? 'serializes to the same string'
|
||||
: (0, _jestMatcherUtils.printReceived)(received)
|
||||
}`
|
||||
);
|
||||
};
|
||||
|
||||
exports.printDiffOrStringify = printDiffOrStringify;
|
||||
|
||||
const printExpectedConstructorName = (label, expected) =>
|
||||
printConstructorName(label, expected, false, true) + '\n';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user