jest-diff
Advanced tools
Comparing version 14.0.0 to 14.2.0-alpha.ca8bfb6e
@@ -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" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113
4458
2
+ Addedjest-matcher-utils@14.2.0-alpha.ca8bfb6e(transitive)
- Removedjest-matcher-utils@14.0.0(transitive)