jest-matcher-utils
Advanced tools
Comparing version 18.1.0 to 18.5.0-alpha.7da3df39
@@ -15,3 +15,5 @@ /** | ||
const prettyFormat = require('pretty-format'); | ||
const AsymmetricMatcherPlugin = require('pretty-format/build/plugins/AsymmetricMatcher'); | ||
const PLUGINS = [AsymmetricMatcherPlugin]; | ||
@@ -31,4 +33,7 @@ | ||
const EXPECTED_COLOR = chalk.green; | ||
const EXPECTED_BG = chalk.bgGreen; | ||
const RECEIVED_COLOR = chalk.red; | ||
const RECEIVED_BG = chalk.bgRed; | ||
@@ -83,3 +88,3 @@ const NUMBERS = [ | ||
throw new Error(`value of unknown type: ${ value }`); | ||
throw new Error(`value of unknown type: ${value}`); | ||
}; | ||
@@ -94,3 +99,4 @@ | ||
maxDepth, | ||
min: true }); | ||
min: true, | ||
plugins: PLUGINS }); | ||
@@ -101,3 +107,4 @@ } catch (e) { | ||
maxDepth, | ||
min: true }); | ||
min: true, | ||
plugins: PLUGINS }); | ||
@@ -111,5 +118,14 @@ } | ||
const printReceived = object => RECEIVED_COLOR(stringify(object)); | ||
const printExpected = value => EXPECTED_COLOR(stringify(value)); | ||
const highlightTrailingWhitespace = (text, bgColor) => | ||
text.replace(/\s+$/gm, bgColor('$&')); | ||
const printReceived = object => highlightTrailingWhitespace( | ||
RECEIVED_COLOR(stringify(object)), | ||
RECEIVED_BG); | ||
const printExpected = value => highlightTrailingWhitespace( | ||
EXPECTED_COLOR(stringify(value)), | ||
EXPECTED_BG); | ||
const printWithType = ( | ||
@@ -188,3 +204,3 @@ name, | ||
EXPECTED_COLOR(expected) + ( | ||
secondArgument ? `, ${ EXPECTED_COLOR(secondArgument) }` : '') + | ||
secondArgument ? `, ${EXPECTED_COLOR(secondArgument)}` : '') + | ||
chalk.dim(')')); | ||
@@ -195,3 +211,5 @@ | ||
module.exports = { | ||
EXPECTED_BG, | ||
EXPECTED_COLOR, | ||
RECEIVED_BG, | ||
RECEIVED_COLOR, | ||
@@ -203,2 +221,3 @@ ensureActualIsNumber, | ||
getType, | ||
highlightTrailingWhitespace, | ||
matcherHint, | ||
@@ -205,0 +224,0 @@ pluralize, |
{ | ||
"name": "jest-matcher-utils", | ||
"description": "A set of utility functions for jest-matchers and related packages", | ||
"version": "18.1.0", | ||
"version": "18.5.0-alpha.7da3df39", | ||
"repository": { | ||
@@ -11,9 +11,6 @@ "type": "git", | ||
"main": "build/index.js", | ||
"scripts": { | ||
"test": "../../packages/jest-cli/bin/jest.js" | ||
}, | ||
"dependencies": { | ||
"chalk": "^1.1.3", | ||
"pretty-format": "^18.1.0" | ||
"pretty-format": "^18.5.0-alpha.7da3df39" | ||
} | ||
} |
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
5571
168
2
+ Addedansi-styles@3.2.1(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedpretty-format@18.5.0-alpha.7da3df39(transitive)
- Removedpretty-format@18.1.0(transitive)