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

@impz/testing

v6.12.0

Published

A real impd on stand-ins, for Bun tests of code that drives impd through @impz/client

Readme

@impz/testing

A real impd, the imp host daemon, for the tests of code that drives impd through @impz/client. impd runs its own startup, API, broker and lifecycle in the test process, on stand-ins for the VMs and the host. A test starts one in about 50 ms, so code that talks to impd needs no KVM host.

It runs on Bun only, under bun test: impd uses bun:sqlite. Each release matches the @impz/client release of the same version.

bun add --dev @impz/testing

Start and stop

import { onTestFinished, test } from 'bun:test';
import { startTestImpd } from '@impz/testing';

test('it creates an imp', async () => {
  const impd = await startTestImpd();

  onTestFinished(impd.stop);

  await impd.seedImage('ubuntu');
  await impd.client.imps.create({ name: 'box', image: 'ubuntu' });
});

startTestImpd(options) takes:

  • env: impd settings, as the IMP_* variables impd reads at start. A setting that turns on HTTPS or OpenTelemetry export needs the package that impd loads for it, which the package lists as an optional peer dependency: add acme-client or the @opentelemetry/* exporters to your dev dependencies.
  • onLog: a callback for each line impd logs. impd writes nothing to stderr.

It returns:

| Field | What it is | | --------------------- | ------------------------------------------------------------------- | | url | impd's API on a loopback port, for a client the test builds itself | | client | an @impz/client client on url with TEST_TOKEN, the root token | | seedImage(name) | adds an image of that name, which imps.create boots | | startGuest(impName) | starts the stand-in guest of a created imp, for reverse forwards | | fireTicker(label) | runs one of impd's periodic jobs now; no job runs on its own | | stop() | stops impd and removes its data |

The client sleeps and wakes an imp as it does on a real host: client.imps.sleep({ name }) and client.imps.wake({ name }).

The stand-in guest

An imp on this impd runs no VM, so nothing runs inside it. startGuest(impName) answers impd for the imp's guest agent, and its connect(port) plays a process in the imp that dials a reverse forward on that guest port. It returns a Node Duplex: what the test writes reaches the forward's local end, and what that end sends back is what the test reads.

import { openReverseForward } from '@impz/client';
import { TEST_TOKEN } from '@impz/testing';

const guest = await impd.startGuest('box');

const forward = openReverseForward({
  baseUrl: impd.url,
  token: TEST_TOKEN,
  name: 'box',
  guest: { network: 'tcp', port: 4000 },
  connect: (url, headers) => new WebSocket(url, { headers: { ...headers } }),
  onConnection: (accept) => {
    // relay to the local end, as the app under test does
  },
});

await forward.listening;

const stream = await guest.connect(4000);

The guest relays bytes and EOFs as the real guest agent's reverse forwards do, and drops its connections when the imp sleeps. Testing against impd lists what it copies and what it does not.

What this impd does not do

It boots no VM, runs no command in an imp, and reaches no network: an exec, a file copy or an egress probe needs a real impd host. The broker refuses every upstream.