{"id":28241135,"url":"https://github.com/eliihen/jest-prop-type-error","last_synced_at":"2025-06-15T13:04:33.191Z","repository":{"id":54813685,"uuid":"132918880","full_name":"eliihen/jest-prop-type-error","owner":"eliihen","description":"      Improves prop-types support in Jest by failing tests on prop-type errors instead of ignoring them","archived":false,"fork":false,"pushed_at":"2021-01-27T17:25:03.000Z","size":98,"stargazers_count":41,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-01T01:22:25.034Z","etag":null,"topics":["jest","proptypes","react","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/eliihen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-10T15:22:53.000Z","updated_at":"2022-10-05T07:58:44.000Z","dependencies_parsed_at":"2022-08-14T03:40:22.654Z","dependency_job_id":null,"html_url":"https://github.com/eliihen/jest-prop-type-error","commit_stats":null,"previous_names":["eliihen/jest-prop-type-error","esphen/jest-prop-type-error"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliihen%2Fjest-prop-type-error","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliihen%2Fjest-prop-type-error/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliihen%2Fjest-prop-type-error/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliihen%2Fjest-prop-type-error/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eliihen","download_url":"https://codeload.github.com/eliihen/jest-prop-type-error/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliihen%2Fjest-prop-type-error/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258568104,"owners_count":22721745,"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":["jest","proptypes","react","testing"],"created_at":"2025-05-19T04:13:06.092Z","updated_at":"2025-06-11T23:32:09.850Z","avatar_url":"https://github.com/eliihen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jest-prop-type-error\n\n\u003e Improves prop-types support in Jest by failing tests on prop-type errors\n\u003e instead of ignoring them\n\n[prop-types][pt] is a library from Facebook that makes it easy to verify that\nthe props passed to a [React][react] component is of the correct type. However,\nit only allows us runtime type checking, which means some failures can slip by\ninto production.\n\nThis is possible to solve with [Jest][jest] by making prop-type errors throw\ninstead of only logging a warning. In this case your tests would run and\nwhenever a wrong prop is passed to a component, the prop-type validation would\npick this up and fail the test. Then we would be able to verify that the props\nthat are passed to our components are good compile-time, provided the tests\nrun when we build our production bundle.\n\nThat is what this library does!\n\n[Read this blog][blog] for a more in-depth explanation.\n\n## Before\n![The test shows a warning and passes](assets/proptype-test-warning.png)\n\n## After\n![The test shows an error and fails](assets/proptype-test-error.png)\n\n# Install\n\n    yarn add -D jest-prop-type-error\n\n# Usage\n\nIn order to enable us to detect prop-type errors and fail the test, you need to\nadd the following to your `package.json`'s jest section.\n\n      \"setupFiles\": [\n        \"jest-prop-type-error\"\n      ]\n\nIf there is no jest section in your `package.json`, add one and use that.\n\nNow simply run your tests like usual, and prop-type errors will throw instead\nof logging a warning!\n\n# Usage with Create React App\n\nCreate React App doesn't allow the use of the `setupFiles` directive. To use with \ncreate-react-app, simply require 'jest-prop-type-error' in your `setupTests.js` file \nafter installing the package:\n\n      import 'jest-prop-type-error'\n\n# Requirements\n\nRequires node 6 or later\n\n# Acknowledgments\n\nThanks to [Stian Didriksen][stian] for the idea in his talk about Jest at the\nReactJS Oslo Meetup 9th May 2018.\n\n[pt]: https://facebook.github.io/react/docs/typechecking-with-proptypes.html\n[blog]: https://medium.com/shark-bytes/type-checking-with-prop-types-in-jest-e0cd0dc92d5\n[react]: https://reactjs.org/\n[jest]: https://facebook.github.io/jest/\n[stian]: https://twitter.com/stipsan\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feliihen%2Fjest-prop-type-error","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feliihen%2Fjest-prop-type-error","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feliihen%2Fjest-prop-type-error/lists"}