{"id":20038505,"url":"https://github.com/yahoo/jsx-test","last_synced_at":"2025-07-30T14:36:29.371Z","repository":{"id":26175052,"uuid":"29620714","full_name":"yahoo/jsx-test","owner":"yahoo","description":"An easy way to test your React Components (`.jsx` files).","archived":false,"fork":false,"pushed_at":"2023-03-21T05:03:37.000Z","size":2810,"stargazers_count":27,"open_issues_count":4,"forks_count":17,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-05T06:37:19.111Z","etag":null,"topics":["javascript","react","react-components","testing","web"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yahoo.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":"2015-01-21T22:08:32.000Z","updated_at":"2021-10-14T18:55:12.000Z","dependencies_parsed_at":"2024-06-19T00:01:14.111Z","dependency_job_id":"6b2c11d7-cbe4-4076-a309-1cfffd45ccf3","html_url":"https://github.com/yahoo/jsx-test","commit_stats":{"total_commits":109,"total_committers":27,"mean_commits":4.037037037037037,"dds":0.6605504587155964,"last_synced_commit":"dd5646977d7fbef9f4502ae3f7c28801f6223859"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/yahoo/jsx-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fjsx-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fjsx-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fjsx-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fjsx-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yahoo","download_url":"https://codeload.github.com/yahoo/jsx-test/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fjsx-test/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267883080,"owners_count":24160225,"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-30T02:00:09.044Z","response_time":70,"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":["javascript","react","react-components","testing","web"],"created_at":"2024-11-13T10:29:35.245Z","updated_at":"2025-07-30T14:36:29.346Z","avatar_url":"https://github.com/yahoo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsx-test\n[![npm version](https://img.shields.io/npm/v/jsx-test.svg?style=flat-square)](https://www.npmjs.com/package/jsx-test)\n[![Build Status](https://travis-ci.org/yahoo/jsx-test.svg?branch=master)](https://travis-ci.org/yahoo/jsx-test)\n[![Dependency Status](https://img.shields.io/david/yahoo/jsx-test.svg?style=flat-square)](https://david-dm.org/yahoo/jsx-test)\n[![devDependency Status](https://img.shields.io/david/dev/yahoo/jsx-test.svg?style=flat-square)](https://david-dm.org/yahoo/jsx-test#info=devDependencies)\n\n`jsx-test` is a tool that makes it easy to test '.jsx' files and includes some helpers for testing react components.\n\nThe main features of `jsx-test` are:\n\n* Includes some helpers to simplify the test of React Components.\n* Assertion methods to check the component renders the correct html based on the given `props`.\n* Does NOT automock your dependencies.\n* Is much simpler and faster than Jest.\n* Works with `mocha`, `jasmine` or any other test framework.\n\n*Note:* If you would like to require jsx files directly please follow [these instructions](https://babeljs.io/docs/setup/)\n\n## Install\n\n```\nnpm install --save-dev jsx-test\n```\n\n## Usage\n### simulateEvent\n```js\nsimulateEvent(ReactComponent element, String event, Object? eventData)\nsimulateEvent(DOMElement element, String event, Object? eventData)\n```\n\nSimulates an `event` on an `element`.\n\n### renderComponent\n```js\nReactElement renderComponent(ReactComponent comp, Object? props, any? children)\n```\n\nRenders a component w/ its props and children.\n\n### unmountComponent\n```js\nBoolean unmountComponent(ReactComponent comp)\n```\n\nUnmount a component.\n\n### elementQuerySelector\n```js\nDOMElement elementQuerySelector(ReactComponent comp, String selector)\n```\n\nGets 1st child of `comp` using selector `selector`\n\n### elementQuerySelectorAll\n```js\nDOMElement[] elementQuerySelectorAll(ReactComponent comp, String selector)\n```\n\nGets children of `comp` using selector `selector`\n\n### stubComponent\n```js\nReactComponent stubComponent(ReactElement tag, any? children, boolean? showDataProps)\nReactComponent stubComponent(String tag, any? children, boolean? showDataProps)\n```\nCreates a stub component with `tag` and its `children`. If `showDataProps` is true, all props will be set in the rendered `DOMElement` in the form of `data-\u003cpropKey\u003e = \u003cpropValue\u003e`.\n\n### withContext\n```js\nReactComponent withContext(ReactComponent Component, Object context)\n```\nWraps component in a context creating component.\n\n### assertRender\n```js\nassertRender(ReactComponent Component, Object props, String expectedHTML)\n```\nAssert component render matches the `expectedHTML`. The `expectedHTML` regex conversion can be seen [here](https://github.com/yahoo/jsx-test/blob/master/test/assertRender.test.js).\n\n### assertNotRender\n```js\nassertNotRender(ReactComponent Component, Object props, String unexpectedHTML)\n```\nThe reverse of `assertRender`.\n\n## Example\n\nCheck our [examples](https://github.com/3den/jsx-test/tree/master/example) and [tests](https://github.com/3den/jsx-test/tree/master/test).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahoo%2Fjsx-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyahoo%2Fjsx-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahoo%2Fjsx-test/lists"}