Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 14.0.0 to 14.2.0-alpha.ca8bfb6e

2

build/constants.js

@@ -15,3 +15,3 @@ /**

module.exports.NO_DIFF_MESSAGE =
module.exports.NO_DIFF_MESSAGE =
chalk.gray.underline('Compared values have no visual difference');

@@ -32,41 +32,41 @@ /**

if (part.added || part.removed) {
isDifferent = true;}
isDifferent = true;
}
const lines = part.value.split('\n');
const color = part.added ?
chalk.green :
const color = part.added ?
chalk.green :
part.removed ? chalk.red : chalk.white;
if (lines[lines.length - 1] === '') {
lines.pop();}
lines.pop();
}
return lines.map(line => {
const mark = part.added ?
chalk.green('+') :
const mark = part.added ?
chalk.green('+') :
part.removed ? chalk.red('-') : ' ';
return mark + ' ' + color(line) + '\n';}).
join('');}).
join('');} else
{
return mark + ' ' + color(line) + '\n';
}).join('');
}).join('');
} else {
result = jsDiff.diffChars(a, b).map(part => {
if (part.added || part.removed) {
isDifferent = true;}
isDifferent = true;
}
const color = part.added ?
chalk.green :
const color = part.added ?
chalk.green :
part.removed ? chalk.red : chalk.gray;
return color(part.value);}).
join('');}
return color(part.value);
}).join('');
}
if (isDifferent) {
return ANNOTATION + result;} else
{
return NO_DIFF_MESSAGE;}}
return ANNOTATION + result;
} else {
return NO_DIFF_MESSAGE;
}
}
module.exports = diffStrings;

@@ -14,3 +14,3 @@ /**

const chalk = require('chalk');
const diffStrings = require('./diffStrings');var _require =
const diffStrings = require('./diffStrings');var _require =
require('jest-matcher-utils');const getType = _require.getType;

@@ -26,14 +26,14 @@ const jsxLikeExtension = require('pretty-format/plugins/ReactTestComponent');

if (a === b) {
return NO_DIFF_MESSAGE;}
return NO_DIFF_MESSAGE;
}
if (getType(a) !== getType(b)) {
return chalk.reset.gray(
'Comparing different types of values.\n' +
`Actual: '${ chalk.cyan(getType(b)) }'` +
', ' +
`Expected: '${ chalk.cyan(getType(a)) }'`);}
'Comparing different types of values.\n' +
`Actual: '${ chalk.cyan(getType(b)) }'` +
', ' +
`Expected: '${ chalk.cyan(getType(a)) }'`);
}
switch (getType(a)) {

@@ -44,13 +44,13 @@ case 'string':

case 'boolean':
return chalk.gray('Actual: ') + chalk.red(b) +
'\n' +
return chalk.gray('Actual: ') + chalk.red(b) +
'\n' +
chalk.gray('Expected: ') + chalk.green(a);
default:
return diffStrings(
prettyFormat(a, { plugins: [jsxLikeExtension] }),
prettyFormat(b, { plugins: [jsxLikeExtension] }));}}
prettyFormat(a, { plugins: [jsxLikeExtension] }),
prettyFormat(b, { plugins: [jsxLikeExtension] }));}
}
module.exports = diff;
{
"name": "jest-diff",
"version": "14.0.0",
"version": "14.2.0-alpha.ca8bfb6e",
"repository": {

@@ -13,11 +13,5 @@ "type": "git",

"diff": "^2.2.3",
"jest-matcher-utils": "^14.0.0",
"jest-matcher-utils": "^14.2.0-alpha.ca8bfb6e",
"pretty-format": "^3.5.0"
},
"jest": {
"automock": false,
"rootDir": "./src",
"scriptPreprocessor": "../../babel-jest",
"testEnvironment": "node"
},
"scripts": {

@@ -24,0 +18,0 @@ "test": "../../packages/jest-cli/bin/jest.js"

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