{"id":15062093,"url":"https://github.com/wellguimaraes/mocha-snapshots","last_synced_at":"2026-02-09T17:32:31.909Z","repository":{"id":21733337,"uuid":"93899503","full_name":"wellguimaraes/mocha-snapshots","owner":"wellguimaraes","description":"Snapshot/regression testing for using with Mocha, specially for React+Enzyme users.","archived":false,"fork":false,"pushed_at":"2023-01-25T08:17:43.000Z","size":144,"stargazers_count":52,"open_issues_count":7,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-14T07:33:06.651Z","etag":null,"topics":["enzyme","mocha","react","snapshots","testing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wellguimaraes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-09T21:52:25.000Z","updated_at":"2024-01-28T08:45:30.000Z","dependencies_parsed_at":"2023-02-15T11:35:20.416Z","dependency_job_id":null,"html_url":"https://github.com/wellguimaraes/mocha-snapshots","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wellguimaraes%2Fmocha-snapshots","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wellguimaraes%2Fmocha-snapshots/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wellguimaraes%2Fmocha-snapshots/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wellguimaraes%2Fmocha-snapshots/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wellguimaraes","download_url":"https://codeload.github.com/wellguimaraes/mocha-snapshots/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230494918,"owners_count":18235046,"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":["enzyme","mocha","react","snapshots","testing"],"created_at":"2024-09-24T23:30:15.565Z","updated_at":"2026-02-09T17:32:26.800Z","avatar_url":"https://github.com/wellguimaraes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mocha Snapshots\nSnapshot/regression testing for using with Mocha, specially for React+Enzyme users.\n\n## Install it\n`npm i mocha-snapshots --save`\n\n## Use it\n```es6\nimport { expect } from 'chai';\nimport { shallow } from 'enzyme';\nimport MyComponent from './path/to/MyComponent';\n\ndescribe('\u003cMyComponent /\u003e', () =\u003e {\n  it('should match snapshot', () =\u003e {\n    const wrapper = shallow(\u003cMyComponent /\u003e)\n    \n    // You can match Enzyme wrappers\n    expect(wrapper).to.matchSnapshot();\n    \n    // Strings\n    expect('you can match strings').to.matchSnapshot();\n    \n    // Numbers\n    expect(123).to.matchSnapshot();\n    \n    // Or any object\n    expect({ a: 1, b: { c: 1 } }).to.matchSnapshot();\n   \n  });\n});\n```\n\n## Run your tests\nAdd a require argument to your test script/command \n\n`mocha --require mocha-snapshots`\n\n## Disable classNames cleanup\nTo prevent false mismatches, mocha-snapshots sanitizes className props by default. You can disable this behavior before running your tests:\n```js\nimport mochaSnapshots from 'mocha-snapshots';\n\nmochaSnapshots.setup({ sanitizeClassNames: false })\n```\n\n## Update snapshots\nSet an environment variable `UPDATE` and run your test script or add the flag `--update`  when running Mocha:\n\n```\nUPDATE=1 mocha --require mocha-snapshots\n``` \nor\n```\nmocha --require mocha-snapshots --update\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwellguimaraes%2Fmocha-snapshots","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwellguimaraes%2Fmocha-snapshots","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwellguimaraes%2Fmocha-snapshots/lists"}