jest-image-snapshot
Advanced tools
Comparing version 2.11.1 to 2.12.0
{ | ||
"name": "jest-image-snapshot", | ||
"version": "2.11.1", | ||
"version": "2.12.0", | ||
"description": "Jest matcher for image comparisons. Most commonly used for visual regression testing.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -1,11 +0,7 @@ | ||
<h1> | ||
<center> | ||
<br /> | ||
<img src="./jest-image-snapshot.png" alt="Jest Image Snapshot - One Amex" width="50%" /> | ||
<br /><br /> | ||
</center> | ||
<h1 align="center"> | ||
<img src='https://github.com/americanexpress/jest-image-snapshot/raw/master/jest-image-snapshot.png' alt="Jest Image Snapshot - One Amex" width='50%'/> | ||
</h1> | ||
[![npm version](https://badge.fury.io/js/jest-image-snapshot.svg)](https://badge.fury.io/js/jest-image-snapshot) | ||
[![Build Status](https://travis-ci.org/americanexpress/jest-image-snapshot.svg?branch=master)](https://travis-ci.org/americanexpress/jest-image-snapshot) | ||
[![npm](https://img.shields.io/npm/v/jest-image-snapshot)](https://www.npmjs.com/package/jest-image-snapshot) | ||
[![Travis (.org) branch](https://img.shields.io/travis/americanexpress/jest-image-snapshot/master)](https://travis-ci.org/americanexpress/jest-image-snapshot) | ||
[![Mentioned in Awesome Jest](https://awesome.re/mentioned-badge.svg)](https://github.com/jest-community/awesome-jest) | ||
@@ -22,7 +18,7 @@ | ||
* [Features](#Features) | ||
* [Usage](#Usage) | ||
* [API](#API) | ||
* [Available Scripts](#Available%20Scripts) | ||
* [Contributing](#Contributing) | ||
* [Features](#-features) | ||
* [Usage](#-usage) | ||
* [API](#-api) | ||
* [Available Scripts](#-available-scripts) | ||
* [Contributing](#-contributing) | ||
@@ -122,2 +118,3 @@ ## โจ Features | ||
* `runInProcess`: (default `false`) Runs the diff in process without spawning a child process. | ||
* `dumpDiffToConsole`: (default `false`) Will output base64 string of a diff image to console in case of failed tests (in addition to creating a diff image). This string can be copy-pasted to a browser address string to preview the diff for a failed test. | ||
@@ -124,0 +121,0 @@ ```javascript |
@@ -216,2 +216,3 @@ /* | ||
diffPixelCount, | ||
imgSrcString: `data:image/png;base64,${pngBuffer}`, | ||
}; | ||
@@ -218,0 +219,0 @@ } else if (shouldUpdate({ pass, updateSnapshot, updatePassedSnapshot })) { |
@@ -39,2 +39,3 @@ /* | ||
chalk, | ||
dumpDiffToConsole, | ||
}) { | ||
@@ -69,9 +70,13 @@ let pass = true; | ||
if (result.diffSize) { | ||
failure = `Expected image to be the same size as the snapshot (${result.imageDimensions.baselineWidth}x${result.imageDimensions.baselineHeight}), but was different (${result.imageDimensions.receivedWidth}x${result.imageDimensions.receivedHeight}).\n` | ||
+ `${chalk.bold.red('See diff for details:')} ${chalk.red(result.diffOutputPath)}`; | ||
failure = `Expected image to be the same size as the snapshot (${result.imageDimensions.baselineWidth}x${result.imageDimensions.baselineHeight}), but was different (${result.imageDimensions.receivedWidth}x${result.imageDimensions.receivedHeight}).\n`; | ||
} else { | ||
failure = `Expected image to match or be a close match to snapshot but was ${differencePercentage}% different from snapshot (${result.diffPixelCount} differing pixels).\n` | ||
+ `${chalk.bold.red('See diff for details:')} ${chalk.red(result.diffOutputPath)}`; | ||
failure = `Expected image to match or be a close match to snapshot but was ${differencePercentage}% different from snapshot (${result.diffPixelCount} differing pixels).\n`; | ||
} | ||
failure += `${chalk.bold.red('See diff for details:')} ${chalk.red(result.diffOutputPath)}`; | ||
if (dumpDiffToConsole) { | ||
failure += `\n${chalk.bold.red('Or paste below image diff string to your browser`s URL bar.')}\n ${result.imgSrcString}`; | ||
} | ||
return failure; | ||
@@ -133,2 +138,3 @@ }; | ||
runInProcess: commonRunInProcess = false, | ||
dumpDiffToConsole: commonDumpDiffToConsole = false, | ||
} = {}) { | ||
@@ -147,2 +153,3 @@ return function toMatchImageSnapshot(received, { | ||
runInProcess = commonRunInProcess, | ||
dumpDiffToConsole = commonDumpDiffToConsole, | ||
} = {}) { | ||
@@ -204,2 +211,3 @@ const { | ||
chalk, | ||
dumpDiffToConsole, | ||
}); | ||
@@ -206,0 +214,0 @@ }; |
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
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
3048732
503
247