Test NitroUI apps the way users use them, without a device or simulator.
📖 Documentation · Quick Start · API reference · Cookbook
- Familiar API: follows React Native Testing Library, so if you've used RNTL or React Testing Library you already know it.
- Fast and simple: tests run in Node or Bun on Vitest,
bun testor Jest. No app builds, simulators or devices. - Realistic interactions:
userEvent.tap()anduserEvent.type()go through NitroUI's gesture recognizers and native text input events, like a real touch or keystroke. - Simulated device: change the keyboard, safe-area insets, color scheme or screen size, and NitroUI's own hooks see it.
bun add --dev nitro-ui-testing-libraryThen add the setup entry for your test runner: see Test runner setup for Vitest (recommended), Bun and Jest.
Only the latest NitroUI release is supported, currently nitro-ui-renderer 0.3.0 with React 19.3.
import { render, screen, userEvent } from 'nitro-ui-testing-library'
import { Counter } from '../Counter'
test('counts taps', async () => {
await render(<Counter />)
await userEvent.tap(screen.getByText('Increment'))
await userEvent.tap(screen.getByText('Increment'))
expect(screen.getByText('Count: 2')).toBeMounted()
})See examples/basic for a complete NitroUI app tested on all three runners.
- Introduction: how it compares to end-to-end tests
- API reference:
render, queries, matchers,userEventanddevice - How to query, Troubleshooting and FAQ
- Cookbook: recipes for async events, custom render, keyboard, safe area and dark mode
The library lives in packages/testing-library.
bun install
bun run test # Jest, Vitest and bun test, in every package
bun run validate # format, typecheck, tests, the example app and the docs
bun run docs:dev # the documentation site, from website/See AGENTS.md for more on the repo's setup.
MIT