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

@sensigo/realm-testing

v0.7.1

Published

Testing utilities for Realm workflows — fixtures, assertions, mocks, and in-memory store.

Readme

@sensigo/realm-testing

@sensigo/realm-testing — testing utilities for Realm workflows. Use this package to write unit and integration tests against your workflow definitions without making real service calls or writing to disk.

Installation

npm install --save-dev @sensigo/realm-testing

Requires @sensigo/realm at the same version to be installed in your project.

Usage — YAML Fixture Tests

Fixture tests are the fastest way to test a complete workflow. Each fixture file declares the initial params, mock service responses, agent step outputs, and the expected final state. The runFixtureTests runner loads your workflow, drives it to completion using the fixture data, and returns a result for each fixture.

// workflow-test.ts
import { describe, it, expect } from 'vitest';
import { runFixtureTests } from '@sensigo/realm-testing';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

describe('my-workflow fixtures', async () => {
  const results = await runFixtureTests({
    workflowPath: path.join(__dirname, '../my-workflow'), // accepts workflow.yaml path OR its containing directory
    fixturesPath: path.join(__dirname, '../my-workflow/fixtures'),
  });

  for (const result of results) {
    it(result.name, () => {
      expect(result.passed, result.error).toBe(true);
    });
  }
});

Usage — Programmatic Tests

Use programmatic tests when you need fine-grained control over a single step, a specific execution path, or assertions on individual evidence entries.

import { describe, it, expect } from 'vitest';
import { InMemoryStore, assertFinalState } from '@sensigo/realm-testing';
import { loadWorkflowFromFile } from '@sensigo/realm'; // NOTE: from @sensigo/realm, not @sensigo/realm-testing
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

describe('my-workflow programmatic', () => {
  it('run reaches expected final state', async () => {
    const store = new InMemoryStore();
    const definition = await loadWorkflowFromFile(
      path.join(__dirname, '../my-workflow/workflow.yaml'),
    );
    const run = await store.create({
      workflowId: definition.id,
      workflowVersion: definition.version,
      params: { input: 'hello' },
    });

    // drive the run to completion first — see examples/02-ticket-classifier/ for a full test
    assertFinalState(run, 'completed');
  });
});

API Reference

Store

| Symbol | Description | | --------------- | --------------------------------------------------------------------------------------- | | InMemoryStore | In-memory RunStore implementation. No I/O, no locking. Safe to use in parallel tests. |

Fixtures

| Symbol | Description | | ----------------------- | -------------------------------------------------- | | loadFixtureFromFile | Load a single fixture from a .yaml file path. | | loadFixtureFromString | Parse a fixture from a YAML string. | | loadFixturesFromDir | Load all *.yaml fixtures from a directory. | | TestFixture | Type — a parsed fixture object. | | MockOperations | Type — the mock service call map within a fixture. |

Mocks

| Symbol | Description | | ----------------------- | -------------------------------------------------------------------------------- | | MockServiceRecorder | Records adapter calls for later assertion. | | createAgentDispatcher | Creates a dispatcher that returns fixture-defined agent step outputs. | | createGateResponder | Creates a gate responder that auto-resolves gates using fixture-defined choices. |

Assertions

| Symbol | Description | | --------------------- | -------------------------------------------------------------- | | assertFinalState | Assert the run reached a specific terminal state. | | assertStepSucceeded | Assert a named step completed without error. | | assertStepFailed | Assert a named step is in the failed steps list. | | assertStepOutput | Assert the output of a completed step matches a value. | | assertEvidenceHash | Assert the evidence hash for a step matches an expected value. |

Unit test helpers

| Symbol | Description | | ----------------- | -------------------------------------------------------------------- | | testStepHandler | Run a single step handler in isolation and return its output. | | testProcessor | Run a processor function against a run record and return the result. | | testAdapter | Invoke an adapter operation and return the ServiceResponse. |

Runner

| Symbol | Description | | ------------------------ | --------------------------------------------------------------------------------------- | | runFixtureTests | Drive a workflow to completion for all fixtures in a directory. Returns TestResult[]. | | RunFixtureTestsOptions | Type — options for runFixtureTests (workflowPath, fixturesPath, registry?). | | TestResult | Type — result of a single fixture run (name, passed, error?). |

Servers

| Symbol | Description | | ------------------------ | ------------------------------------------------------------------------------------------------------------------------- | | startGitHubMockServer | Integration testing helper for workflows that use the GitHub adapter. See the examples/08-pr-review/ example for usage. | | GitHubMockServerHandle | Type — handle returned by startGitHubMockServer (url, close()). |

Full documentation

Full documentation: https://github.com/sensigo-hq/realm