{"id":15200010,"url":"https://github.com/georgetaveras1231/babel-plugin-jest-enzyme-react-16-patch","last_synced_at":"2026-02-07T16:02:23.986Z","repository":{"id":230775781,"uuid":"780149821","full_name":"GeorgeTaveras1231/babel-plugin-jest-enzyme-react-16-patch","owner":"GeorgeTaveras1231","description":"Babel plugin to ease migration from enzyme and support incremental adoption of newer react versions","archived":false,"fork":false,"pushed_at":"2024-03-31T21:38:22.000Z","size":1180,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-21T06:37:08.639Z","etag":null,"topics":["babel","enzyme","react","react-16","react-17","react-18"],"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/GeorgeTaveras1231.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-31T20:43:30.000Z","updated_at":"2024-03-31T21:38:07.000Z","dependencies_parsed_at":"2024-03-31T21:32:12.390Z","dependency_job_id":"56f0d057-2b77-43a8-bef7-1a47865810dd","html_url":"https://github.com/GeorgeTaveras1231/babel-plugin-jest-enzyme-react-16-patch","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"df1e374853f6b261e95fa04b28d2412ac0243814"},"previous_names":["georgetaveras1231/babel-plugin-jest-enzyme-react-16-patch"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GeorgeTaveras1231/babel-plugin-jest-enzyme-react-16-patch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeorgeTaveras1231%2Fbabel-plugin-jest-enzyme-react-16-patch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeorgeTaveras1231%2Fbabel-plugin-jest-enzyme-react-16-patch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeorgeTaveras1231%2Fbabel-plugin-jest-enzyme-react-16-patch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeorgeTaveras1231%2Fbabel-plugin-jest-enzyme-react-16-patch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GeorgeTaveras1231","download_url":"https://codeload.github.com/GeorgeTaveras1231/babel-plugin-jest-enzyme-react-16-patch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeorgeTaveras1231%2Fbabel-plugin-jest-enzyme-react-16-patch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29199519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T14:35:27.868Z","status":"ssl_error","status_checked_at":"2026-02-07T14:25:51.081Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["babel","enzyme","react","react-16","react-17","react-18"],"created_at":"2024-09-28T02:40:15.997Z","updated_at":"2026-02-07T16:02:23.969Z","avatar_url":"https://github.com/GeorgeTaveras1231.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# babel-plugin-jest-enzyme-react-16-patch\n\nA babel plugin that swaps the react version to version 16 when it determines that we are using `enzyme` in the test. This allows you to upgrade react and use it incrementally without waiting on enzyme to introduce support for it, at the date of writing this (September 2021) this support is not yet available. This is especially useful in large repos where you may have hundreds of files referencing `enzyme`.\n\nIt does this by introducing mocks for react\n\n```diff\nimport React from 'react';\nimport { mount } from 'enzyme';\n+import { configure as _configureEnzyme } from 'enzyme';\n+import _React16Adpater from 'enzyme-adapter-react-16';\n\n+_configureEnzyme({\n+   adapter: new _React16Adapter()\n+})\n\n+jest.mock('react', () =\u003e require('react-16'));\n+jest.mock('react-dom', () =\u003e require('react-dom-16'));\n+jest.mock('react-dom/test-utils', () =\u003e require('react-dom-16/test-utils'));\n\nit('matches snapshot', () =\u003e {\n  const subject = mount(\u003cdiv\u003eHello\u003c/div\u003e);\n  expect(subject.html()).toMatchInlineSnapshot();\n});\n```\n\n# Install\n\n```\nnpm install --save-dev babel-plugin-jest-enzyme-react-16-patch\n```\n\n# Requirements\n\nFor this to work as expected, you must install react 16 as `react-16`. You can do this by using the `npm:` protocol in your package.json\n\n```json\n{\n  \"dependencies\": {\n    \"react\": \"^18\",\n    \"react-dom\": \"^18\",\n    \"react-16\": \"npm:react@^16\",\n    \"react-dom-16\": \"npm:react-dom@^16\"\n  }\n}\n```\n\n# Usage\n\nAdd this to list of babel plugins used by jest\n\nIn babel config:\n\n```json\n{\n  \"plugins\": [\"babel-plugin-jest-enzyme-react-16-patch\"]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorgetaveras1231%2Fbabel-plugin-jest-enzyme-react-16-patch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeorgetaveras1231%2Fbabel-plugin-jest-enzyme-react-16-patch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorgetaveras1231%2Fbabel-plugin-jest-enzyme-react-16-patch/lists"}