Socket
Socket
Sign inDemoInstall

jest-diff

Package Overview
Dependencies
Maintainers
3
Versions
230
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-diff - npm Package Compare versions

Comparing version 19.0.0 to 19.1.0-alpha.eed82034

yarn.lock

8

build/constants.js

@@ -15,8 +15,8 @@ /**

exports.NO_DIFF_MESSAGE =
chalk.dim('Compared values have no visual difference.');
exports.NO_DIFF_MESSAGE = chalk.dim(
'Compared values have no visual difference.');
exports.SIMILAR_MESSAGE =
chalk.dim(
exports.SIMILAR_MESSAGE = chalk.dim(
'Compared values serialize to the same structure.\n' +
'Printing internal object structure without calling `toJSON` instead.');

@@ -36,10 +36,6 @@ /**

const getColor = (added, removed) =>
added ?
chalk.red :
removed ? chalk.green : chalk.dim;
added ? chalk.red : removed ? chalk.green : chalk.dim;
const getBgColor = (added, removed) =>
added ?
chalk.bgRed :
removed ? chalk.bgGreen : chalk.dim;
added ? chalk.bgRed : removed ? chalk.bgGreen : chalk.dim;

@@ -50,4 +46,6 @@ const highlightTrailingWhitespace = (line, bgColor) =>

const getAnnotation = options =>
chalk.green('- ' + (options && options.aAnnotation || 'Expected')) + '\n' +
chalk.red('+ ' + (options && options.bAnnotation || 'Received')) + '\n\n';
chalk.green('- ' + (options && options.aAnnotation || 'Expected')) +
'\n' +
chalk.red('+ ' + (options && options.bAnnotation || 'Received')) +
'\n\n';

@@ -57,3 +55,5 @@ const diffLines = (a, b) => {

return {
diff: diff.diffLines(a, b).map(part => {const
diff: diff.
diffLines(a, b).
map(part => {const
added = part.added,removed = part.removed;

@@ -72,8 +72,12 @@ if (part.added || part.removed) {

return lines.map(line => {
return lines.
map(line => {
const highlightedLine = highlightTrailingWhitespace(line, bgColor);
const mark = color(part.added ? '+' : part.removed ? '-' : ' ');
return mark + ' ' + color(highlightedLine) + '\n';
}).join('');
}).join('').trim(),
}).
join('');
}).
join('').
trim(),
isDifferent };

@@ -88,4 +92,4 @@

// we can be sure that at least 1 line has been "hidden".
const shouldShowPatchMarks =
(hunk, oldLinesCount) => oldLinesCount > hunk.oldLines;
const shouldShowPatchMarks = (hunk, oldLinesCount) =>
oldLinesCount > hunk.oldLines;

@@ -112,5 +116,7 @@ const createPatchMark = hunk => {

return {
diff: diff.structuredPatch('', '', a, b, '', '', options).
diff: diff.
structuredPatch('', '', a, b, '', '', options).
hunks.map(hunk => {
const lines = hunk.lines.map(line => {
const lines = hunk.lines.
map(line => {
const added = line[0] === '+';

@@ -124,3 +130,4 @@ const removed = line[0] === '-';

return color(highlightedLine) + '\n';
}).join('');
}).
join('');

@@ -131,3 +138,5 @@ isDifferent = true;

lines;
}).join('').trim(),
}).
join('').
trim(),
isDifferent };

@@ -134,0 +143,0 @@

@@ -18,2 +18,3 @@ /**

const AsymmetricMatcherPlugin = require('pretty-format/build/plugins/AsymmetricMatcher');
const ImmutablePlugins = require('pretty-format/build/plugins/ImmutablePlugins');

@@ -33,4 +34,4 @@ const chalk = require('chalk');

ReactElementPlugin,
AsymmetricMatcherPlugin];
AsymmetricMatcherPlugin].
concat(ImmutablePlugins);
const FORMAT_OPTIONS = {

@@ -71,7 +72,5 @@ plugins: PLUGINS };

if (expectedType !== getType(b)) {
return (
' Comparing two different types of values.' +
` Expected ${chalk.green(expectedType)} but ` +
`received ${chalk.red(getType(b))}.`);
return ' Comparing two different types of values.' +
` Expected ${chalk.green(expectedType)} but ` +
`received ${chalk.red(getType(b))}.`;
}

@@ -78,0 +77,0 @@

{
"name": "jest-diff",
"version": "19.0.0",
"version": "19.1.0-alpha.eed82034",
"repository": {

@@ -12,6 +12,6 @@ "type": "git",

"chalk": "^1.1.3",
"diff": "^3.0.0",
"jest-matcher-utils": "^19.0.0",
"pretty-format": "^19.0.0"
"diff": "^3.2.0",
"jest-matcher-utils": "^19.1.0-alpha.eed82034",
"pretty-format": "^19.1.0-alpha.eed82034"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc