{"id":21070848,"url":"https://github.com/raxjs/enzyme-adapter-rax","last_synced_at":"2025-07-29T05:07:51.631Z","repository":{"id":100944672,"uuid":"259935041","full_name":"raxjs/enzyme-adapter-rax","owner":"raxjs","description":"Enzyme adapter for Rax","archived":false,"fork":false,"pushed_at":"2020-05-19T02:48:36.000Z","size":22,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-22T17:08:18.768Z","etag":null,"topics":["enzyme","rax"],"latest_commit_sha":null,"homepage":"https://github.com/alibaba/rax","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/raxjs.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":"2020-04-29T13:37:47.000Z","updated_at":"2020-12-04T15:09:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"9b52f5f8-9d3f-49b5-9473-f0b09d129480","html_url":"https://github.com/raxjs/enzyme-adapter-rax","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/raxjs/enzyme-adapter-rax","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raxjs%2Fenzyme-adapter-rax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raxjs%2Fenzyme-adapter-rax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raxjs%2Fenzyme-adapter-rax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raxjs%2Fenzyme-adapter-rax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raxjs","download_url":"https://codeload.github.com/raxjs/enzyme-adapter-rax/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raxjs%2Fenzyme-adapter-rax/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267633017,"owners_count":24118751,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["enzyme","rax"],"created_at":"2024-11-19T18:48:35.909Z","updated_at":"2025-07-29T05:07:51.611Z","avatar_url":"https://github.com/raxjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# enzyme-adapter-rax\n\nThis is an adapter to support using the [Enzyme](https://airbnb.io/enzyme/) UI\ncomponent testing library with [Rax](https://rax.js.org).\n\n## Supported Rax version\n\nThe adapter supports Rax 1.x.\n\n## Usage\n\nAdd the library to your development dependencies:\n\n```sh\n# If using npm\nnpm install --save-dev enzyme-adapter-rax\n\n# If using yarn\nyarn add --dev enzyme-adapter-rax\n```\n\nThen in the setup code for your tests, configure Enzyme to use the adapter\nprovided by this package:\n\n```js\nimport { configure } from 'enzyme';\nimport Adapter from 'enzyme-adapter-rax';\n\nconfigure({ adapter: new Adapter() });\n```\n\nOnce the adapter is configured, you can write Enzyme tests for your Rax\nUI components following the [Enzyme docs](https://airbnb.io/enzyme/).\nThe full DOM rendering, shallow rendering and string rendering modes are\nsupported.\n\n## Example projects\n\nFor runnable example projects, see the [examples/](examples/) directory. To run the\nexamples locally, clone this repository, then run:\n\n```sh\ncd examples/\u003cproject name\u003e\nnpm install\nnpm test\n```\n\n## Differences compared to Enzyme + React\n\nThe general intent is that tests written using Enzyme + React can be easily made\nto work with Enzyme + Rax. However there are some differences\nin behavior between this adapter and Enzyme's React adapters to be aware of:\n\n### Simulating events\n\nThe [simulate](https://airbnb.io/enzyme/docs/api/ReactWrapper/simulate.html)\nAPI does not dispatch actual DOM events in the React adapters, it just calls\nthe corresponding handler. The Rax adapter does dispatch an actual event\nusing `element.dispatchEvent(...)`.\n\n### Re-render\nWhen target tested component is triggered rerender, you need use `jest.runAllTimers()` to resolve the async render.\n\n**Example:**\n\n```js\nconst wrapper = mount(\u003cCounter initialCount={5} /\u003e);\nwrapper.find('button').simulate('click');\njest.runAllTimers();\nexpect(wrapper.text()).toEqual('Current value: 6');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraxjs%2Fenzyme-adapter-rax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraxjs%2Fenzyme-adapter-rax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraxjs%2Fenzyme-adapter-rax/lists"}