{"dist":{"shasum":"db56830a86c1cb8d4622f9c1381f2f3df2da82cd","tarball":"https://registry.npmjs.org/cypress-image-snapshot/-/cypress-image-snapshot-2.0.0-1.tgz","fileCount":31,"integrity":"sha512-mQC6p+mtCvD6kCBXzoF3N8nM3Zp5e4Sef+al/ejuzyfz7IG3jO8iQ8pdknxAoorTr3adLZlrA/D4IBxKFXSU2A==","signatures":[{"sig":"MEYCIQDkPwBFGX/To0davGib7ADZ8nqYi2YT0hcBLj3l2cMqowIhANTpfhpdR67czB3KccJsBn3gJNBQHBiZHMJSJriItAAe","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbZOOLCRA9TVsSAnZWagAAe7sP/RVRtqbvC8fG7a+YWyTw\nvNsbQ6eKVACq5jls2zmvTsgc3RCCZw959KnB1626znRmK/BhzcH4flL0+4pu\nzrS89fXJGIgAeu/YuYYdShM6WGqT66aCaZAqF5hnZtscbR7i+7Bdh2hanPx9\nUFO8AHkL5Q+wz5E5vb7n2pOllHttkhRKfN1FDYs9esyXdPPULdtU4pHgwy/z\nIQ8DzE8ZQv+R9nq2fbXRjo9hEXTEfTAbq+SDIrPb8ySXoiHAluKVmjqd2/m4\niQLz5qNa+5dMVQKRuRZeq3TyNOq1TJ67FUB9fD1dr1X3RYuibsA+DrrijGpV\negw8C1iB88+i/fvIAs39bnoBh7QxFT+Ql2qyDAntyiovmQfmj+cXTmxarMDC\nR8zrau5PsKfCxwzwhWAOhyk8omP+Os3MKglRIIA00U1siBlA3HrXaG9sQXnV\n+o8tEYwCh3w82eA+yQbNihOhK9laXlg3ziflzl/MbU16RzphelqP398NY2Zs\n1QJLP66Mc+5deQTjOfjX65qq3OugG7/j1t1RQhpelEkrKF/YntotqXbCLGov\nK3KnAz4DdAR42xAgK2/XlD2jFinLcmYLB0S3Tnngshrym1DazQ9dcAkJ9Ujt\n8lGhDztagK52xbIM63o20Vb2dUX5s31iZ0HF+xp2JRqLnOZyD6BVyrW++JOA\nqesj\r\n=oD/T\r\n-----END PGP SIGNATURE-----\r\n"},"jest":{"testPathIgnorePatterns":["<rootDir>/examples/","<rootDir>/node_modules/"]},"name":"cypress-image-snapshot","babel":{"plugins":["transform-object-rest-spread"],"presets":[["env",{"targets":{"node":"6.10"}}]]},"files":["*.js"],"author":{"name":"Jack Cross","email":"jack@palmer.net"},"readme":"# Cypress Image Snapshot\n\nCypress Image Snapshot binds [jest-image-snapshot](https://github.com/americanexpress/jest-image-snapshot)'s image diffing logic to [Cypress.io](https://cypress.io) commands. **The goal is to catch visual regressions during integration tests.** Here's what it looks like when tests run with the Cypress GUI.\n\n<img width=\"500px\" src=\"https://user-images.githubusercontent.com/4060187/41942389-5a6705ae-796d-11e8-8003-fadbf7ccf43d.gif\" alt=\"Cypress Image Snapshot in action\"/>\n\nThis then constructs/uploads an image diff for analysis.\n\n<img width=\"500px\" src=\"https://user-images.githubusercontent.com/4060187/41942163-72c8c20a-796c-11e8-9149-c295341864d3.png\" alt=\"Cypress Image Snapshot Diff\"/>\n\nBoom! Turns out you probably can't delete that intern's CSS from 6 months ago that somehow made its way to prod. :see_no_evil:\n\n## Installation\n\nInstall from npm\n\n```bash\nnpm install cypress-image-snapshot\n```\n\nthen add the following in your project's `<rootDir>/cypress/plugins/index.js`:\n\n```js\nconst {\n  addMatchImageSnapshotPlugin,\n} = require('cypress-image-snapshot/plugin');\n\nmodule.exports = on => {\n  addMatchImageSnapshotPlugin(on);\n};\n```\n\nand in `<rootDir>/cypress/support/commands.js` add:\n\n```js\nimport { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command';\n\naddMatchImageSnapshotCommand(options);\n```\n\n## Syntax\n\n```js\n// addMatchImageSnapshotPlugin\naddMatchImageSnapshotPlugin(on);\n\n// addMatchImageSnapshotCommand\naddMatchImageSnapshotCommand();\naddMatchImageSnapshotCommand(commandName);\naddMatchImageSnapshotCommand(options);\naddMatchImageSnapshotCommand(commandName, options);\n\n// matchImageSnapshot\n.matchImageSnapshot();\n.matchImageSnapshot(name);\n.matchImageSnapshot(options);\n.matchImageSnapshot(name, options);\n\n// ---or---\n\ncy.matchImageSnapshot();\ncy.matchImageSnapshot(name);\ncy.matchImageSnapshot(options);\ncy.matchImageSnapshot(name, options);\n```\n\n## Usage\n\n```js\ndescribe('Login', () => {\n  it('should be publicly accessible', () => {\n    cy.visit('/login');\n\n    // snapshot name will be the test title\n    cy.matchImageSnapshot();\n\n    // snapshot name will be the name passed in\n    cy.matchImageSnapshot('login');\n\n    // options object passed in\n    cy.matchImageSnapshot(options);\n\n    // match element snapshot\n    cy.get('#login').matchImageSnapshot();\n  });\n});\n```\n\n## Options\n\nAny options for [`cy.screenshot()`](https://docs.cypress.io/api/commands/screenshot.html#Arguments) and [jest-image-snapshot](https://github.com/americanexpress/jest-image-snapshot#optional-configuration) can be passed in the `options` argument to `addMatchImageSnapshotCommand` and `cy.matchImageSnapshot()`. The local options in `cy.matchImageSnapshot()` will overwrite the default options set in `addMatchImageSnapshot`.\n\nFor example, the default options we use in `<rootDir>/cypress/support/commands.js` are:\n\n```js\naddMatchImageSnapshotCommand({\n  failureThreshold: 0.03, // threshold for entire image\n  failureThresholdType: 'percent', // percent of image or number of pixels\n  customDiffConfig: { threshold: 0.1 }, // threshold for each pixel\n  capture: 'viewport', // capture viewport in screenshot\n});\n```\n\n## How it works\n\nWe really enjoy the diffing workflow of jest-image-snapshot and wanted to have a similar workflow when using Cypress. Because of this, under the hood we use some of jest-image-snapshot's internals and simply bind them to Cypress's commands and plugins APIs.\n\nThe workflow of `cy.matchImageSnapshot()` when running Cypress is:\n\n1.  Take a screenshot with `cy.screenshot()` named according to the current test.\n2.  Check if a saved snapshot exists in `<rootDir>/cypress/snapshots` and if so diff against that snapshot.\n3.  If there is a resulting diff, save it to `<rootDir>/cypress/snapshots/__diff_output__`.\n4.  If the diff is intended, run Cypress again with `--env updateSnapshots=true` to update the snapshots.\n","license":"MIT","scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir .","prebuild":"rimraf *.js","precommit":"lint-staged","prepublish":"npm run build"},"_npmUser":{"name":"jayjaycross","email":"jackjocross@gmail.com"},"prettier":{"semi":true,"printWidth":80,"singleQuote":true,"trailingComma":"es5"},"repository":{"url":"https://github.com/palmerhq/cypress-image-snapshot","type":"git"},"description":"Cypress bindings for jest-image-snapshot.","directories":{},"licenseText":"MIT License\n\nCopyright (c) 2018-present The Palmer Group\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.","lint-staged":{"ignore":["*.js"],"linters":{"**/*.{js,json,md}":["prettier --write","git add"]}},"maintainers":[{"name":"jayjaycross","email":"jackjocross@gmail.com"}],"dependencies":{"fs-extra":"^7.0.0","jest-image-snapshot":"2.4.3"},"eslintConfig":{"env":{"cypress/globals":true},"extends":["airbnb-base","prettier"],"plugins":["cypress"]},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^23.2.0","husky":"^0.14.3","eslint":"^5.2.0","rimraf":"^2.6.2","prettier":"^1.13.6","babel-cli":"^6.26.0","lint-staged":"^7.2.0","babel-preset-env":"^1.7.0","eslint-plugin-import":"^2.13.0","eslint-plugin-cypress":"^2.0.1","eslint-config-prettier":"^2.9.0","eslint-config-airbnb-base":"^13.0.0","babel-plugin-transform-object-rest-spread":"^6.26.0"},"peerDependencies":{"cypress":"^3.0.2"},"_npmOperationalInternal":{"tmp":"tmp/cypress-image-snapshot_2.0.0-1_1533338507518_0.40848615483642803","host":"s3://npm-registry-packages"},"_id":"cypress-image-snapshot@2.0.0-1","version":"2.0.0-1"}