
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
@larsthorup/react-test-renderer
Advanced tools
A custom React renderer for faster testing of React components
A custom React renderer for faster testing of React components
npm install @larsthorup/react-test-renderer
Import:
import { TestRenderer } from '@larsthorup/react-test-renderer';
Render:
const renderer = await TestRenderer.create(<App />);
Find by text, type or props:
// return object if found
expect(renderer.findByType('div')).toBeDefined();
// return undefined if not found
expect(renderer.findByType('blink')).not.toBeDefined();
// find by text
expect(renderer.findByText('Save').type).toBe('button');
// find all
expect(renderer.findAllByProps({ type: 'checkbox' })).toHaveLength(5);
Inspect type and props:
expect(renderer.findByProps({ placeholder: 'title' }).type).toBe('input');
expect(renderer.findByProps({ placeholder: 'title' }).props.value).toBe('Swim');
Trigger event handlers:
import { change, click, submit } from "@larsthorup/react-test-renderer";
...
await click(renderer.findByText("Login"));
await change(renderer.findByProps({ placeholder: 'password' }), { target: { value: 'secret' } });
await submit(renderer.findByType('form'), { preventDefault: () => {} });
npm version minor
npm publish
git push
FAQs
A custom React renderer for faster testing of React components
We found that @larsthorup/react-test-renderer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.