testing-library/react-testing-library — reverse-engineered prompt

Reverse engineered prompt

GitHub

Build me a lightweight JavaScript library for testing React components in a way that feels like how a real person uses the page. I want developers to render a component in a test, find things by visible text, labels, buttons, and other accessible clues, click or type into them, and make clear assertions without poking at component internals.

It should work with normal React components, hooks, and classes, and it should clean up after each test so tests don’t leak into each other. Include a small public API like render, screen queries, event helpers, and good defaults around React act so tests are reliable.

Please add examples for a simple hidden message checkbox and a login form that calls fetch and handles loading, success, and errors. Package it so it can be installed as a dev dependency and used with Jest. Look up current React testing docs online if you need to.

Want more depth? Deep Reverse