Socket
Socket
Sign inDemoInstall

jest-image-snapshot

Package Overview
Dependencies
Maintainers
5
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-image-snapshot - npm Package Compare versions

Comparing version 6.1.0 to 6.1.1

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [6.1.1](https://github.com/americanexpress/jest-image-snapshot/compare/v6.1.0...v6.1.1) (2023-07-25)
### Bug Fixes
* only updatePassedSnapshot if updateSnapshot is also true ([#327](https://github.com/americanexpress/jest-image-snapshot/issues/327)) ([b9d9c3f](https://github.com/americanexpress/jest-image-snapshot/commit/b9d9c3f16ab0e10a3e1320d03efb52e81675d2aa)), closes [#320](https://github.com/americanexpress/jest-image-snapshot/issues/320) [#322](https://github.com/americanexpress/jest-image-snapshot/issues/322) [#324](https://github.com/americanexpress/jest-image-snapshot/issues/324)
# [6.1.0](https://github.com/americanexpress/jest-image-snapshot/compare/v6.0.0...v6.1.0) (2022-12-02)

@@ -2,0 +9,0 @@

8

package.json
{
"name": "jest-image-snapshot",
"version": "6.1.0",
"version": "6.1.1",
"description": "Jest matcher for image comparisons. Most commonly used for visual regression testing.",

@@ -67,3 +67,2 @@ "main": "src/index.js",

"lodash": "^4.17.4",
"mkdirp": "^0.5.1",
"pixelmatch": "^5.1.0",

@@ -77,2 +76,7 @@ "pngjs": "^3.4.0",

},
"peerDependenciesMeta": {
"jest": {
"optional": true
}
},
"husky": {

@@ -79,0 +83,0 @@ "hooks": {

@@ -18,3 +18,2 @@ /*

const path = require('path');
const mkdirp = require('mkdirp');
const pixelmatch = require('pixelmatch');

@@ -152,5 +151,4 @@ const ssim = require('ssim.js');

const shouldUpdate = ({ pass, updateSnapshot, updatePassedSnapshot }) => (
(!pass && updateSnapshot) || (pass && updatePassedSnapshot)
);
const shouldUpdate = ({ pass, updateSnapshot, updatePassedSnapshot }) =>
updateSnapshot && (!pass || (pass && updatePassedSnapshot));

@@ -231,3 +229,3 @@ const shouldFail = ({

if (!fs.existsSync(baselineSnapshotPath)) {
mkdirp.sync(path.dirname(baselineSnapshotPath));
fs.mkdirSync(path.dirname(baselineSnapshotPath), { recursive: true });
fs.writeFileSync(baselineSnapshotPath, receivedImageBuffer);

@@ -300,3 +298,3 @@ result = { added: true };

if (storeReceivedOnFailure) {
mkdirp.sync(path.dirname(receivedSnapshotPath));
fs.mkdirSync(path.dirname(receivedSnapshotPath), { recursive: true });
fs.writeFileSync(receivedSnapshotPath, receivedImageBuffer);

@@ -306,3 +304,3 @@ result = { receivedSnapshotPath };

mkdirp.sync(path.dirname(diffOutputPath));
fs.mkdirSync(path.dirname(diffOutputPath), { recursive: true });
const composer = composeDiff({

@@ -342,3 +340,3 @@ diffDirection, baselineImage, diffImage, receivedImage, imageWidth, imageHeight, onlyDiff,

} else if (shouldUpdate({ pass, updateSnapshot, updatePassedSnapshot })) {
mkdirp.sync(path.dirname(baselineSnapshotPath));
fs.mkdirSync(path.dirname(baselineSnapshotPath), { recursive: true });
fs.writeFileSync(baselineSnapshotPath, receivedImageBuffer);

@@ -345,0 +343,0 @@ result = { updated: true };

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