mirror of
https://github.com/Azure/setup-helm.git
synced 2025-07-16 02:30:36 +00:00
v2 new release (#77)
This commit is contained in:
committed by
GitHub
parent
217bf70cbd
commit
199ab446df
39
node_modules/jest-diff/build/index.js
generated
vendored
39
node_modules/jest-diff/build/index.js
generated
vendored
@ -59,25 +59,35 @@ Object.defineProperty(exports, 'diffStringsUnified', {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _prettyFormat = _interopRequireDefault(require('pretty-format'));
|
||||
|
||||
var _chalk = _interopRequireDefault(require('chalk'));
|
||||
|
||||
var _jestGetType = _interopRequireDefault(require('jest-get-type'));
|
||||
|
||||
var _prettyFormat = _interopRequireDefault(require('pretty-format'));
|
||||
|
||||
var _cleanupSemantic = require('./cleanupSemantic');
|
||||
|
||||
var _constants = require('./constants');
|
||||
|
||||
var _diffLines = require('./diffLines');
|
||||
|
||||
var _printDiffs = require('./printDiffs');
|
||||
var _normalizeDiffOptions = require('./normalizeDiffOptions');
|
||||
|
||||
var _constants = require('./constants');
|
||||
var _printDiffs = require('./printDiffs');
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
|
||||
const getCommonMessage = (message, options) => {
|
||||
const {commonColor} = (0, _normalizeDiffOptions.normalizeDiffOptions)(
|
||||
options
|
||||
);
|
||||
return commonColor(message);
|
||||
};
|
||||
|
||||
const {
|
||||
AsymmetricMatcher,
|
||||
DOMCollection,
|
||||
@ -105,10 +115,11 @@ const FALLBACK_FORMAT_OPTIONS = {
|
||||
};
|
||||
const FALLBACK_FORMAT_OPTIONS_0 = {...FALLBACK_FORMAT_OPTIONS, indent: 0}; // Generate a string that will highlight the difference between two values
|
||||
// with green and red. (similar to how github does code diffing)
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
|
||||
function diff(a, b, options) {
|
||||
if (Object.is(a, b)) {
|
||||
return _constants.NO_DIFF_MESSAGE;
|
||||
return getCommonMessage(_constants.NO_DIFF_MESSAGE, options);
|
||||
}
|
||||
|
||||
const aType = (0, _jestGetType.default)(a);
|
||||
@ -171,7 +182,7 @@ function comparePrimitive(a, b, options) {
|
||||
const aFormat = (0, _prettyFormat.default)(a, FORMAT_OPTIONS);
|
||||
const bFormat = (0, _prettyFormat.default)(b, FORMAT_OPTIONS);
|
||||
return aFormat === bFormat
|
||||
? _constants.NO_DIFF_MESSAGE
|
||||
? getCommonMessage(_constants.NO_DIFF_MESSAGE, options)
|
||||
: (0, _diffLines.diffLinesUnified)(
|
||||
aFormat.split('\n'),
|
||||
bFormat.split('\n'),
|
||||
@ -190,13 +201,14 @@ function sortSet(set) {
|
||||
function compareObjects(a, b, options) {
|
||||
let difference;
|
||||
let hasThrown = false;
|
||||
const noDiffMessage = getCommonMessage(_constants.NO_DIFF_MESSAGE, options);
|
||||
|
||||
try {
|
||||
const aCompare = (0, _prettyFormat.default)(a, FORMAT_OPTIONS_0);
|
||||
const bCompare = (0, _prettyFormat.default)(b, FORMAT_OPTIONS_0);
|
||||
|
||||
if (aCompare === bCompare) {
|
||||
difference = _constants.NO_DIFF_MESSAGE;
|
||||
difference = noDiffMessage;
|
||||
} else {
|
||||
const aDisplay = (0, _prettyFormat.default)(a, FORMAT_OPTIONS);
|
||||
const bDisplay = (0, _prettyFormat.default)(b, FORMAT_OPTIONS);
|
||||
@ -208,17 +220,17 @@ function compareObjects(a, b, options) {
|
||||
options
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
hasThrown = true;
|
||||
} // If the comparison yields no results, compare again but this time
|
||||
// without calling `toJSON`. It's also possible that toJSON might throw.
|
||||
|
||||
if (difference === undefined || difference === _constants.NO_DIFF_MESSAGE) {
|
||||
if (difference === undefined || difference === noDiffMessage) {
|
||||
const aCompare = (0, _prettyFormat.default)(a, FALLBACK_FORMAT_OPTIONS_0);
|
||||
const bCompare = (0, _prettyFormat.default)(b, FALLBACK_FORMAT_OPTIONS_0);
|
||||
|
||||
if (aCompare === bCompare) {
|
||||
difference = _constants.NO_DIFF_MESSAGE;
|
||||
difference = noDiffMessage;
|
||||
} else {
|
||||
const aDisplay = (0, _prettyFormat.default)(a, FALLBACK_FORMAT_OPTIONS);
|
||||
const bDisplay = (0, _prettyFormat.default)(b, FALLBACK_FORMAT_OPTIONS);
|
||||
@ -231,8 +243,11 @@ function compareObjects(a, b, options) {
|
||||
);
|
||||
}
|
||||
|
||||
if (difference !== _constants.NO_DIFF_MESSAGE && !hasThrown) {
|
||||
difference = _constants.SIMILAR_MESSAGE + '\n\n' + difference;
|
||||
if (difference !== noDiffMessage && !hasThrown) {
|
||||
difference =
|
||||
getCommonMessage(_constants.SIMILAR_MESSAGE, options) +
|
||||
'\n\n' +
|
||||
difference;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user