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

@opentf/web-test

v1.25.0

Published

DOM testing utilities for OTF Web

Readme

@opentf/web-test

DOM testing utilities for OTF Web: mount compiled components or page factories, query them with Testing Library, and tear down their lifecycle after each test.

Installation

pnpm add -D @opentf/web-test @opentf/esdev-plugin-web

Install esdev 0.14 or newer. The test runner supplies the DOM; this package does not install a replacement DOM or its own compiler plugin.

Configuration

Create esdev.test.json:

{
  "plugins": [{
    "module": "@opentf/esdev-plugin-web",
    "export": "createOtfwPlugin",
    "options": { "target": "csr", "failOnError": true }
  }],
  "test": { "setup": ["@opentf/web-test/setup"] }
}

The plugin compiles JSX imports. The per-file setup registers afterEach(cleanup). This follows esdev's test configuration.

Usage

import { expect, test } from "runtime:test";
import { render } from "@opentf/web-test";
import Counter from "./Counter.jsx";

test("increments", () => {
  const { getByRole } = render(Counter);
  const button = getByRole("button", { name: "Count: 0" });
  button.click();
  expect(button.textContent).toBe("Count: 1");
});
esdev test --config=esdev.test.json --dom

User interactions

userEvent is re-exported from @testing-library/user-event. Run its session, typing, selection and clipboard workflows in a real browser:

import { userEvent } from "@opentf/web-test";
const user = userEvent.setup();
await user.click(button);
await user.type(input, "Ada");
esdev test --config=esdev.test.json --browser

Install a supported browser and its matching driver as described in esdev browser testing. In esdev 0.14's native DOM, userEvent.setup() cannot replace the frozen navigator's clipboard, and input selection is incomplete. Use native DOM actions for --dom tests, or --browser for full Testing Library interaction sequences.

API

  • render(Component, props = {}): mounts a compiled component class using its registered .tag, a page factory, or a tag string. Props are assigned before connection. Returns container, unmount() and bound Testing Library queries.
  • unmount(): tears down factory lifecycle and reactive scopes, removes the container, and lets custom-element disconnect run component cleanup. Repeated calls are safe.
  • cleanup(): unmounts every view created by render(). The setup module calls it after each test; otherwise import afterEach from runtime:test and register afterEach(cleanup) yourself.
  • userEvent: Testing Library's interaction API for browser tests.

DOM custom-element lifecycle reactions can settle asynchronously; await observable cleanup effects when testing teardown.