jest-diff
Advanced tools
Comparing version 20.0.3 to 20.1.0-alpha.1
@@ -1,19 +0,22 @@ | ||
'use strict'; /** | ||
* Copyright (c) 2014, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* | ||
*/ | ||
'use strict'; | ||
const chalk = require('chalk'); | ||
exports.NO_DIFF_MESSAGE = chalk.dim( | ||
'Compared values have no visual difference.'); | ||
exports.SIMILAR_MESSAGE = chalk.dim( | ||
'Compared values serialize to the same structure.\n' + | ||
'Printing internal object structure without calling `toJSON` instead.'); | ||
var _chalk = require('chalk');var _chalk2 = _interopRequireDefault(_chalk);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} | ||
exports.NO_DIFF_MESSAGE = _chalk2.default.dim( | ||
'Compared values have no visual difference.'); /** | ||
* Copyright (c) 2014, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* | ||
*/exports.SIMILAR_MESSAGE = _chalk2.default.dim('Compared values serialize to the same structure.\n' + 'Printing internal object structure without calling `toJSON` instead.'); |
@@ -1,2 +0,2 @@ | ||
'use strict';var _require$plugins = | ||
'use strict'; | ||
@@ -13,22 +13,21 @@ | ||
var _prettyFormat = require('pretty-format');var _prettyFormat2 = _interopRequireDefault(_prettyFormat); | ||
var _chalk = require('chalk');var _chalk2 = _interopRequireDefault(_chalk); | ||
var _jestGetType = require('jest-get-type');var _jestGetType2 = _interopRequireDefault(_jestGetType); | ||
var _diff_strings = require('./diff_strings');var _diff_strings2 = _interopRequireDefault(_diff_strings); | ||
var _constants = require('./constants');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} /** | ||
* Copyright (c) 2014, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* | ||
*/var _prettyFormat$plugins = _prettyFormat2.default.plugins;const AsymmetricMatcher = _prettyFormat$plugins.AsymmetricMatcher,HTMLElement = _prettyFormat$plugins.HTMLElement,Immutable = _prettyFormat$plugins.Immutable,ReactElement = _prettyFormat$plugins.ReactElement,ReactTestComponent = _prettyFormat$plugins.ReactTestComponent; | ||
require('pretty-format').plugins;const ReactElement = _require$plugins.ReactElement,ReactTestComponent = _require$plugins.ReactTestComponent,AsymmetricMatcher = _require$plugins.AsymmetricMatcher,HTMLElement = _require$plugins.HTMLElement,Immutable = _require$plugins.Immutable; /** | ||
* Copyright (c) 2014, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* | ||
*/const chalk = require('chalk');var _require = require('jest-matcher-utils');const getType = _require.getType;const prettyFormat = require('pretty-format');const diffStrings = require('./diffStrings');var _require2 = require('./constants');const NO_DIFF_MESSAGE = _require2.NO_DIFF_MESSAGE,SIMILAR_MESSAGE = _require2.SIMILAR_MESSAGE; | ||
const PLUGINS = [ | ||
ReactTestComponent, | ||
ReactElement, | ||
AsymmetricMatcher, | ||
HTMLElement]. | ||
HTMLElement, | ||
AsymmetricMatcher]. | ||
concat(Immutable); | ||
@@ -48,6 +47,6 @@ const FORMAT_OPTIONS = { | ||
if (a === b) { | ||
return NO_DIFF_MESSAGE; | ||
return _constants.NO_DIFF_MESSAGE; | ||
} | ||
const aType = getType(a); | ||
const aType = (0, _jestGetType2.default)(a); | ||
let expectedType = aType; | ||
@@ -70,7 +69,7 @@ let omitDifference = false; | ||
if (expectedType !== getType(b)) { | ||
if (expectedType !== (0, _jestGetType2.default)(b)) { | ||
return ( | ||
' Comparing two different types of values.' + | ||
` Expected ${chalk.green(expectedType)} but ` + | ||
`received ${chalk.red(getType(b))}.`); | ||
` Expected ${_chalk2.default.green(expectedType)} but ` + | ||
`received ${_chalk2.default.red((0, _jestGetType2.default)(b))}.`); | ||
@@ -87,3 +86,3 @@ } | ||
if (multiline) { | ||
return diffStrings(String(a), String(b), options); | ||
return (0, _diff_strings2.default)(String(a), String(b), options); | ||
} | ||
@@ -116,5 +115,5 @@ return null; | ||
try { | ||
diffMessage = diffStrings( | ||
prettyFormat(a, FORMAT_OPTIONS), | ||
prettyFormat(b, FORMAT_OPTIONS), | ||
diffMessage = (0, _diff_strings2.default)( | ||
(0, _prettyFormat2.default)(a, FORMAT_OPTIONS), | ||
(0, _prettyFormat2.default)(b, FORMAT_OPTIONS), | ||
options); | ||
@@ -128,10 +127,10 @@ | ||
// without calling `toJSON`. It's also possible that toJSON might throw. | ||
if (!diffMessage || diffMessage === NO_DIFF_MESSAGE) { | ||
diffMessage = diffStrings( | ||
prettyFormat(a, FALLBACK_FORMAT_OPTIONS), | ||
prettyFormat(b, FALLBACK_FORMAT_OPTIONS), | ||
if (!diffMessage || diffMessage === _constants.NO_DIFF_MESSAGE) { | ||
diffMessage = (0, _diff_strings2.default)( | ||
(0, _prettyFormat2.default)(a, FALLBACK_FORMAT_OPTIONS), | ||
(0, _prettyFormat2.default)(b, FALLBACK_FORMAT_OPTIONS), | ||
options); | ||
if (diffMessage !== NO_DIFF_MESSAGE && !hasThrown) { | ||
diffMessage = SIMILAR_MESSAGE + '\n\n' + diffMessage; | ||
if (diffMessage !== _constants.NO_DIFF_MESSAGE && !hasThrown) { | ||
diffMessage = _constants.SIMILAR_MESSAGE + '\n\n' + diffMessage; | ||
} | ||
@@ -138,0 +137,0 @@ } |
{ | ||
"name": "jest-diff", | ||
"version": "20.0.3", | ||
"version": "20.1.0-alpha.1", | ||
"repository": { | ||
@@ -10,9 +10,9 @@ "type": "git", | ||
"main": "build/index.js", | ||
"browser": "build-es5/index.js", | ||
"dependencies": { | ||
"chalk": "^1.1.3", | ||
"diff": "^3.2.0", | ||
"jest-matcher-utils": "^20.0.3", | ||
"pretty-format": "^20.0.3" | ||
"jest-get-type": "^20.1.0-alpha.1", | ||
"jest-matcher-utils": "^20.1.0-alpha.1", | ||
"pretty-format": "^20.1.0-alpha.1" | ||
} | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
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
11218
5
5
3
227
2
1
+ Addedansi-regex@3.0.1(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedjest-get-type@20.1.0-echo.1(transitive)
+ Addedjest-matcher-utils@20.1.0-echo.1(transitive)
+ Addedpretty-format@20.1.0-echo.1(transitive)
+ Addedsupports-color@5.5.0(transitive)
- Removedjest-matcher-utils@20.0.3(transitive)
- Removedpretty-format@20.0.3(transitive)