Skip to content

About

Pure JS tests for NitroUI apps.

Resources

Code of conduct

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

NitroUI Testing Library
🐆

Test NitroUI apps the way users use them, without a device or simulator.

📖 Documentation · Quick Start · API reference · Cookbook

✨ Why

  • 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 test or Jest. No app builds, simulators or devices.
  • Realistic interactions: userEvent.tap() and userEvent.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.

📦 Installation

bun add --dev nitro-ui-testing-library

Then 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.

🧪 Example

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.

📚 Learn more

🤝 Contributing

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.

License

MIT

About

Pure JS tests for NitroUI apps.

Resources

Code of conduct

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages