npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rozenite/testing

v2.4.0

Published

In-process test doubles for Rozenite plugin communication — run a panel and its react-native.ts entry against each other in Node, without Metro or a simulator.

Readme

rozenite-banner

In-process test doubles for Rozenite plugin communication.

mit licence npm downloads Chat PRs Welcome

Testing a plugin change today usually means running Metro, a simulator, the playground app, and React Native DevTools together — right for pre-release verification, but far too expensive for the most frequent check: that a panel and its react-native.ts entry still agree on the protocol (messages and RPCs).

@rozenite/testing gives you an in-memory Channel pair and a couple of waitFor helpers built on @rozenite/plugin-bridge's channel injection seam, so you can run both halves of a plugin — the real, unmodified panel code and the real, unmodified device code — against each other in Node, in milliseconds. No Metro, no simulator, no DevTools.

Features

  • In-process fake channel pair — connectFakePair() gives you the two ends of a real Channel; hand one to the device side and one to the panel side via getRozeniteDevToolsClient/useRozeniteDevToolsClient's channel option, and both run their actual protocol code.
  • Render the real components — RozeniteChannelProvider hands a channel to every useRozeniteDevToolsClient() in a subtree, so a plugin's own panel components can be rendered with React Testing Library (or any renderer) unmodified — no channel prop threaded through them for tests only.
  • Transport simulation — drop or delay messages in either direction, to test a side that never mounts or a slow transport.
  • waitFor helpers with a deadline — waitForMessage, waitForChannelMessage, and the RPC-aware waitForRpcFrame all take a required timeoutMs and reject with a clear WaitForTimeoutError on expiry, instead of hanging your test suite forever.
  • Runner-agnostic — no dependency on Vitest, Jest, or any runner globals. Everything here returns plain values and promises; keep using your own runner's assertions.

Installation

Install the testing package alongside @rozenite/plugin-bridge, which it builds on:

npm install --save-dev @rozenite/testing @rozenite/plugin-bridge

Quick Start

import { getRozeniteDevToolsClient, createRozeniteRpc } from '@rozenite/plugin-bridge';
import { connectFakePair, waitForMessage } from '@rozenite/testing';

// Two ends of one in-memory Channel.
const { device, panel } = connectFakePair();

// Give one end to each side's real, unmodified client — this is the
// injection seam `@rozenite/plugin-bridge` exposes for exactly this.
const deviceClient = await getRozeniteDevToolsClient('my-plugin', { channel: device });
const panelClient = await getRozeniteDevToolsClient('my-plugin', { channel: panel });

// Wire up the device side's real message handler...
deviceClient.onMessage('get-items', () => {
  deviceClient.send('items', { items: ['a', 'b'] });
});

// ...and drive it from the panel side.
panelClient.send('get-items', {});
const response = await waitForMessage(panelClient, 'items', { timeoutMs: 1000 });
// response is { items: ['a', 'b'] }

The same pattern works for RPC methods built with createRozeniteRpc:

import { createRozeniteRpc } from '@rozenite/plugin-bridge';

const deviceRpc = createRozeniteRpc(deviceClient);
const panelRpc = createRozeniteRpc(panelClient);

deviceRpc.handle('getSnapshot', async () => ({ items: [] }));

const snapshot = await panelRpc.method('getSnapshot').invoke();

Rendering a panel with React Testing Library

Plugin components call useRozeniteDevToolsClient({ pluginId }) themselves and take no channel prop — so to render one in a test, wrap it in RozeniteChannelProvider and give it one end of a fake pair. Every useRozeniteDevToolsClient() below the provider uses that channel instead of resolving a real one from the environment.

import { render, screen } from '@testing-library/react';
import { getRozeniteDevToolsClient } from '@rozenite/plugin-bridge';
import { connectFakePair, RozeniteChannelProvider } from '@rozenite/testing';
import { MyPluginPanel } from '../src/panel';

const { device, panel } = connectFakePair();

// The device side, wired up exactly as `react-native.ts` wires it.
const deviceClient = await getRozeniteDevToolsClient('my-plugin', { channel: device });
deviceClient.onMessage('get-items', () => {
  deviceClient.send('items', { items: ['alpha', 'beta'] });
});

render(
  <RozeniteChannelProvider channel={panel} role="panel">
    <MyPluginPanel />
  </RozeniteChannelProvider>,
);

expect(await screen.findByText('alpha')).toBeTruthy();

role tells the provider which side of the protocol the subtree stands in for. Only the device side announces itself with the plugin-mounted lifecycle message, so role="panel" keeps that message off the wire (and role="device" puts it there) without your test having to set the process-wide __ROZENITE_PANEL__ global. Leave role unset to keep the global's behavior.

The device side can be rendered the same way when it lives in a hook rather than in plain functions:

render(
  <RozeniteChannelProvider channel={device} role="device">
    <DeviceSide />
  </RozeniteChannelProvider>,
);

A channel passed directly to useRozeniteDevToolsClient({ pluginId, channel }) still wins over the provider, and there is no provider in production — plugins render without one and resolve a real channel as before.

Transport simulation

const { device, panel, dropDeviceToPanel, delayPanelToDevice } = connectFakePair();

// Simulate the panel never mounting: every message the device sends is dropped.
dropDeviceToPanel(true);

// Simulate a slow transport in the other direction.
delayPanelToDevice(500);

waitFor helpers

import { waitForMessage, waitForChannelMessage, waitForRpcFrame } from '@rozenite/testing';

// Client-level: waits for the next message of `type`, optionally filtered.
await waitForMessage(
  client,
  'storage:list-response',
  { timeoutMs: 1000 },
  (payload) => payload.requestId === myRequestId,
);

// Channel-level: below the pluginId/type demultiplexing a client does.
await waitForChannelMessage(channel, (message) => isMyEnvelope(message), {
  timeoutMs: 1000,
});

// RPC-aware: waits for a frame on the reserved `rozenite:rpc` message type.
await waitForRpcFrame(client, (frame) => frame.kind === 'request', { timeoutMs: 1000 });

Every one of these rejects with a WaitForTimeoutError — not a hang — when nothing matching arrives before timeoutMs.

Made with ❤️ at Callstack

rozenite is an open source project and will always remain free to use. If you think it's cool, please star it 🌟.

Callstack is a group of React and React Native geeks, contact us at [email protected] if you need any help with these or just want to say hi!

Like the project? ⚛️ Join the team who does amazing stuff for clients and drives React Native Open Source! 🔥