{"id":13807966,"url":"https://github.com/maksimr/karma-image-snapshot","last_synced_at":"2025-03-23T07:33:32.770Z","repository":{"id":37050179,"uuid":"403385213","full_name":"maksimr/karma-image-snapshot","owner":"maksimr","description":"Karma jasmine matcher that performs image comparisons based on jest-image-snapshot for visual regression testing","archived":false,"fork":false,"pushed_at":"2024-04-13T01:48:17.000Z","size":875,"stargazers_count":4,"open_issues_count":3,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-14T10:00:54.503Z","etag":null,"topics":["image-comparison","jasmine","karma","snapshot-testing","visual-regression-testing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maksimr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-09-05T18:34:33.000Z","updated_at":"2024-04-15T15:47:14.703Z","dependencies_parsed_at":"2024-01-27T22:26:02.687Z","dependency_job_id":"919daaa7-07b3-4594-82e1-48adbde051f4","html_url":"https://github.com/maksimr/karma-image-snapshot","commit_stats":{"total_commits":352,"total_committers":3,"mean_commits":"117.33333333333333","dds":0.4289772727272727,"last_synced_commit":"b5e7078224de11bb043f010bf6cb55f0a8fee33f"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":"maksimr/playground","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maksimr%2Fkarma-image-snapshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maksimr%2Fkarma-image-snapshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maksimr%2Fkarma-image-snapshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maksimr%2Fkarma-image-snapshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maksimr","download_url":"https://codeload.github.com/maksimr/karma-image-snapshot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221847087,"owners_count":16890964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image-comparison","jasmine","karma","snapshot-testing","visual-regression-testing"],"created_at":"2024-08-04T01:01:32.915Z","updated_at":"2024-10-28T15:13:45.565Z","avatar_url":"https://github.com/maksimr.png","language":"JavaScript","funding_links":[],"categories":["Testing"],"sub_categories":["Component"],"readme":"# karma-image-snapshot\n![Test](https://github.com/maksimr/karma-image-snapshot/workflows/Test/badge.svg)\n[![Open in Gitpod](https://img.shields.io/badge/Gitpod-Open%20in%20Gitpod-%230092CF.svg)](https://gitpod.io/#https://github.com/maksimr/karma-image-snapshot)\n[![npm](https://img.shields.io/npm/v/karma-image-snapshot)](https://www.npmjs.com/package/karma-image-snapshot)\n\nJasmine matcher that performs image comparisons based\non [jest-image-snapshot](https://github.com/americanexpress/jest-image-snapshot) for visual regression testing\n\n## How to use\n\n```js\n/** karma.config.js*/\nmodule.exports = function(config) {\n  config.set({\n    frameworks: [/*✅*/'snapshot-jasmine', 'jasmine'],\n    /*...*/\n    snapshot: {\n      customSnapshotsDir: require('path').resolve(__dirname, '__image_snapshots__')\n    },\n    browsers: [/*✅*/'SnapshotLauncher' /* or SnapshotHeadlessLauncher*/]\n  });\n};\n```\n\nIf you want to automatically remove outdated snapshots you should add special reporter\n\n```js\n/** karma.config.js*/\nmodule.exports = function(config) {\n  config.set({\n    /*...*/\n    reporters: [/*...*/, /*✅*/'outdated-snapshot']\n  });\n};\n```\n\nNow you can use `window.screenshot`, `window.setViewport` functions and asynchronous jasmine matcher `toMatchImageSnapshot` in your tests\n\n```js\n/** example.e2e.js*/\nit('should compare image snapshots', async function() {\n  /*...*/\n  const image = await window.screenshot();\n  await expectAsync(image).toMatchImageSnapshot();\n});\n```\n\nWorking configuration and test example you can find in `test` directory\n\n## API\n\nAvailable properties for `snapshot` and `toMatchImageSnapshot` you can look [here](https://github.com/americanexpress/jest-image-snapshot#%EF%B8%8F-api)\n\n## Browser flags \u0026 options\nYou can tune browser settings through flags \u0026 options\n\n```js\n/** karma.config.js*/\nmodule.exports = function(config) {\n  config.set({\n    /*...*/\n    customLaunchers: {\n      Chrome: {\n        base: 'SnapshotLauncher',\n        options: /*✅*/{\n          devtools: true\n        },\n        flags: [/*✅*/'--font-render-hinting=none', '--no-sandbox']\n      }\n    }\n  });\n};\n```\n\n## Playwright\n\nYou can use playwright instead of puppeteer\n\n```js\n/** karma.config.js*/\nmodule.exports = function(config) {\n  config.set({\n    /*...*/\n    customLaunchers: {\n      Firefox: {\n        base: 'SnapshotLauncher',\n        browserType: require('playwright').firefox\n      }\n    }\n  });\n};\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaksimr%2Fkarma-image-snapshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaksimr%2Fkarma-image-snapshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaksimr%2Fkarma-image-snapshot/lists"}