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

@arcote.tech/arc-testing

v0.8.25

Published

In-process test harness for Arc — write use-case-shaped tests on bun:test with the same scope API the client uses

Downloads

2,495

Readme

@arcote.tech/arc-testing

In-process test harness for Arc. Write use-case-shaped tests on bun:test using the same scope API the client uses — no port, no mocks of the framework, full type inference from your context.

import { createHarness } from "@arcote.tech/arc-testing";

const h = await createHarness(myContext);

// declare current state
await h.seed.rows("plan", [{ _id: "plan_pro", price: 4900 }]);

// an authenticated actor — the SAME scope API as the app
const creator = h.scope(userToken, { projectId });

await creator.mutation().startCheckout({ projectId, planId: "plan_pro" });
const order = await creator.query().paymentOrder.findOne({ _id: orderId });

// a webhook / route, in-process (real route boundary, no port)
await h.route("payuWebhook", { orderId, status: "COMPLETED" });

// drain the async listener cascade deterministically (no setTimeout)
await h.settle();

// assert events + state with native bun:test expect
expect(h.events.ofType("subscriptionActivated")).toHaveLength(1);
expect(await creator.query().subscription.findOne({ _id: projectId }))
  .toMatchObject({ status: "active" });

API

| | | |---|---| | createHarness(context) | builds the harness (in-memory SQLite, declarative seeds run, listeners active) | | h.scope(token, params) | an authenticated scope — .mutation() (= client useMutation), .query() (= client useQuery, awaited rows) | | h.anonymous() | a scope with no identity (public caller) | | h.seed.rows(store, rows) | raw insert into a view/aggregate store (like withSeed); rows need _id | | h.seed.event(type, payload, { as }) | publish through real projection handlers (and listeners) | | h.route(name, body, { headers, token }) | invoke a route/webhook in-process (real verification + protection gate) | | h.settle() | resolve once the async listener cascade has fully drained | | h.events | typed log: .ofType(name), .last(name), .count(name), .all() |

mutation() / query() are the exact client ScopeAPI accessors (core's MutationExecutor / QueryAccessor) — element names, params, payloads and rows are all inferred from your context. No new naming layer, no any.

Recipe: testing the real billing buy-subscription-card (platform)

Prerequisites (one-time, user-gated):

  1. Publish @arcote.tech/arc, @arcote.tech/arc-host, @arcote.tech/arc-testing to npm.
  2. Add @arcote.tech/arc-testing to packages/billing devDependencies (npm, not link:link: breaks the Docker build).

PayU-free reaction test (avoids the external gateway by injecting the domain event, then asserting the real billing listener cascade — grant → activation):

import { describe, it, expect, beforeEach } from "bun:test";
import { createHarness, type Harness } from "@arcote.tech/arc-testing";
import { getBillingContext } from "@ndt/billing";
import { userToken } from "@ndt/auth";

describe("buy-subscription-card (billing reaction)", () => {
  let h: Harness<ReturnType<typeof getBillingContext>>;
  const accountId = "acc_test";

  beforeEach(async () => { h = await createHarness(getBillingContext()); });

  it("paid order → grant → subscription activated", async () => {
    const user = h.scope(userToken, { accountId, role: "user" });

    // inject the 'payment completed' domain event with the caller's identity,
    // then let the real billingPaymentGrant → billingSubscriptionActivation chain run
    await h.seed.event(
      "paymentOrderCompleted",
      { _id: "order_1", userId: accountId, amountPLNGrosz: 4900, kind: "subscription" },
      { as: { tokenName: "user", params: { accountId, role: "user" } } },
    );
    await h.settle();

    expect(h.events.ofType("subscriptionActivated")).toHaveLength(1);
    const sub = await user.query().subscription.findOne({ _id: accountId });
    expect(sub).toMatchObject({ /* active subscription shape */ });
  });
});

For the full checkout-through-webhook flow (startCheckoutCardAsUserpayuWebhook), stub the PayU client the checkout/route modules call, then drive it with creator.mutation().startCheckoutCardAsUser(...) and h.route("payuWebhook", payuBody) exactly as the self-proof does (tests/buy-subscription-like.test.ts).