{"id":24510476,"url":"https://github.com/mukeshsoni/create-snapshot-test","last_synced_at":"2026-05-08T11:34:11.056Z","repository":{"id":73505346,"uuid":"130055857","full_name":"mukeshsoni/create-snapshot-test","owner":"mukeshsoni","description":"Automatically generate snapshot tests for your react components with random values for the props","archived":false,"fork":false,"pushed_at":"2018-04-20T12:03:42.000Z","size":123,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-22T00:34:01.394Z","etag":null,"topics":["generated-code","jest","react","reactjs","snapshot","testing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mukeshsoni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2018-04-18T12:03:52.000Z","updated_at":"2018-04-20T12:03:43.000Z","dependencies_parsed_at":"2023-06-26T01:43:11.844Z","dependency_job_id":null,"html_url":"https://github.com/mukeshsoni/create-snapshot-test","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/mukeshsoni%2Fcreate-snapshot-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mukeshsoni%2Fcreate-snapshot-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mukeshsoni%2Fcreate-snapshot-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mukeshsoni%2Fcreate-snapshot-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mukeshsoni","download_url":"https://codeload.github.com/mukeshsoni/create-snapshot-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243713391,"owners_count":20335566,"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":["generated-code","jest","react","reactjs","snapshot","testing"],"created_at":"2025-01-22T00:29:13.616Z","updated_at":"2026-05-08T11:34:06.022Z","avatar_url":"https://github.com/mukeshsoni.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### jest-create-snapshot\n\nAutomatically generate snapshot tests for your react components with random values for the props.\n\nIf you specify the path to a folder or directory, it creates snapshot tests for all the components inside that directory. Even for components inside a sub directory inside that directory.\n\nIt works best if you have defined types for your props using either [`prop-types`](https://www.npmjs.com/package/prop-types) or using [`flow`](http://flowtype.org/).\n\nIt will not work with styled components for now.\n\nUsage -\n\n```\n$ npm i -g create-snapshot-test\n; All the usage\n$ create-shapshot-test --help\n\n  Usage: create-snapshot-test [path] [options]\n\n  Generate snapshot tests for your React component.\n    If a directory is passed, it is recursively traversed.\n\n  Options:\n\n    -o, --out \u003cfile\u003e  Write the snapshot test in FILE\n    --no-pretty       Don't pass output through prettier. Default - false\n    optional          If you want to generate values for optional props too\n    -h, --help        output usage information\n\n$ create-snapshot-test path/to/component.js\nGenerated snapshot test\n---------------------------------------------------------\n\nimport React from \"react\";\nimport renderer from \"react-test-renderer\";\nimport FakeComponent from \"/Users/mukesh/Documents/projects/create-snapshot-test/__tests__/__mocks__/fake_component.js\";\n\ntest(\"Should render FakeComponent correctly\", () =\u003e {\n  const tree = renderer\n    .create(\n      \u003cFakeComponent\n        firstName={\"firstName\"}\n        person={{ firstName: \"person.firstName\", age: 1 }}\n      /\u003e\n    )\n    .toJSON();\n  expect(tree).toMatchSnapshot();\n});\n\nOR\n$ create-snapshot-test path/to/component.js -o __tests__/path/to/test_file.js\n```\n\n### API\n\n```\nconst createSnapshotTest = require('create-snapshot-test')\n\nconst snapshotTest = createSnapshotTest('path/to/your/component.js', true /* if you want values to be generated for optional props too */)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmukeshsoni%2Fcreate-snapshot-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmukeshsoni%2Fcreate-snapshot-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmukeshsoni%2Fcreate-snapshot-test/lists"}