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

@ageflow/testing

v0.3.8

Published

Test harness for ageflow workflows — mock agents, inspect call counts, no API calls needed

Downloads

1,249

Readme

@ageflow/testing

npm

Test harness for ageflow workflows. Mock agents return predetermined responses — no CLI installed, no API calls, tests run in milliseconds.

Install

bun add -D @ageflow/testing

Quick example

import { createTestHarness } from "@ageflow/testing";
import { describe, expect, it } from "vitest";
import myWorkflow from "./workflow.js";

describe("my workflow", () => {
  it("runs end-to-end with mocked agents", async () => {
    const harness = createTestHarness(myWorkflow);

    harness.mockAgent("analyze", {
      issues: [{ id: "1", file: "src/app.ts", description: "unused var" }],
    });
    harness.mockAgent("fix", { patch: "- const x\n+ const _x" });

    const result = await harness.run();

    expect(result.outputs["fix"]).toEqual({ patch: "- const x\n+ const _x" });
  });
});

API

createTestHarness(workflow)

Returns a TestHarness for the given workflow definition.

const harness = createTestHarness(workflow);

harness.mockAgent(taskName, response)

Register a mock response for a task. Three forms:

// Always return the same response
harness.mockAgent("classify", { label: "positive", confidence: 0.97 });

// Return different responses on successive calls
harness.mockAgent("fix", [
  { patch: "attempt 1" },  // call 1
  { patch: "attempt 2" },  // call 2 — last element repeats if exhausted
]);

// Simulate a failure (triggers retry logic)
harness.mockAgent("validate", { throws: new Error("syntax error") });

harness.run(input?)

Run the workflow with all mocked runners. Returns WorkflowResult.

const result = await harness.run();
// result.outputs["taskName"] — typed output of each task

Pass an input if your workflow expects one:

const result = await harness.run({ repo: "my-org/my-repo" });

harness.getTask(name)

Inspect call statistics after run():

const stats = harness.getTask("fix");
// stats.callCount  — total spawn calls (includes retried attempts)
// stats.retryCount — how many times the task was retried
// stats.outputs    — all successful outputs, in call order

Testing loops

Loops call inner tasks repeatedly. Use an array mock to return different responses per iteration:

harness.mockAgent("eval", [
  { satisfied: false },  // iteration 1 — keep looping
  { satisfied: false },  // iteration 2
  { satisfied: true },   // iteration 3 — loop exits
]);

Testing HITL workflows

The harness bypasses HITL checkpoints by default (auto-approves). To override:

const harness = createTestHarness({
  ...myWorkflow,
  hooks: {
    onCheckpoint: async (taskName) => {
      // return false to simulate rejection
      return taskName !== "deploy";
    },
  },
});

License

MIT