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

@speqkit/test-kit

v0.9.0

Published

Test a speq plugin against the real kernel, without a project.

Readme

@speqkit/test-kit

Test a speq plugin against the real kernel, without a project.

npm i -D @speqkit/test-kit speqkit
import { afterEach, expect, it } from 'vitest'
import { harness, type Harness } from '@speqkit/test-kit'
import plugin from '../src/index.js'

let kit: Harness
afterEach(async () => { await kit.close() })

it('sends the request it was told to', async () => {
  kit = await harness(plugin, { config: { http: { baseUrl: 'http://localhost:3000' } } })

  const step = await kit.step({ type: 'http', method: 'GET', url: '/health' })

  expect(step.status).toBe('passed')
  expect(step.result.status).toBe(200)
})

There are no fakes in here

A mock ExecContext would be a second implementation of @speqkit/plugin-api — written by us, drifting from the first — and the only thing it could ever prove is that your plugin agrees with our mock. What you need to know is that the plugin works inside speq.

So the kit assembles the actual Registry, the actual Executor and the actual runner, and adds only the two things a plugin cannot get from them by hand: a project root on disk, and a resource scope held open between calls.

That is also why speqkit is a peer dependency here. You test against the kernel you intend to support, and there is one kernel in the tree.

What a harness gives you

const kit = await harness(plugin, {
  with: [otherPlugin],   // a surface to contribute into, a step type to wrap
  config: { http: {} },  // your block in speq.yaml, keyed by short name
  root: '/some/dir',     // default: a temp dir, removed on close()
  artifacts: false       // default: attachments stay in memory
})

| | | |---|---| | kit.step(def, vars?) | run one step; returns the record plus what it attached | | kit.steps(defs, vars?) | several, stopping at the first failure | | kit.assert(def, { last? }) | evaluate one assertion over what the steps produced | | kit.resource(name) | acquire a resource, in scopes the kit holds open | | kit.endTest() | close and reopen the test scope, to watch teardown | | kit.run(tests, reporters?) | whole tests, through the runner | | kit.validate(tests) | the diagnostics a bad test would produce | | kit.discover(query?) | ask your loader what tests exist under the root | | kit.file(path, content) | write a fixture under the root | | kit.events, kit.eventsOf(type) | everything the run emitted | | kit.host, kit.registry, kit.root | the escape hatches | | kit.close() | tear down every scope, remove the temp root |

Things worth knowing

Steps share a scope. kit.step({ id: 'a', … }) binds its result, so the next call can say ${a.field} exactly as a test file does. kit.endTest() clears it.

ctx.host is real. A hand-built Registry has no session, and every ctx.host call on one throws. The kit attaches a host rooted at kit.root, so a plugin that reads host.root or calls host.discover() is testable.

Config is keyed by short name. @speqkit/plugin-http and speqkit-plugin-http both read config.http — the same rule speq.yaml uses.

run() opens its own scopes, the way a real run does. A resource you acquired through kit.resource() is not the one a test inside run() sees. That is not a quirk of the kit; it is what happens in a project.

Assertions resolve their input. kit.assert({ type: 'status', expected: '${a.code}' }) goes through the same resolution the runner applies, so the assertion you test is the one users write.

Starting from nothing

npm create speqkit-plugin my-thing

create-speqkit-plugin scaffolds a plugin with these tests already written.

MIT.