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

@flanksource/gavel

v0.1.3

Published

React components and hooks for consuming gavel's testrunner real-time test progress UI.

Downloads

742

Readme

@flanksource/gavel

React components and hooks for consuming gavel's testrunner UI from your own React apps, fed by gavel's HTTP handlers for real-time test execution progress.

This is the same UI gavel embeds in its binary (gavel test --ui), published as a library so you can render the test tree, summary, and detail panel — and subscribe to live progress over Server-Sent Events — inside any React application. It follows the same model as @flanksource/clicky-ui's useTaskRun hook and TaskProgress component.

Install

npm install @flanksource/gavel

react, react-dom, and @flanksource/clicky-ui are peer dependencies — install them in your app if they aren't already present:

npm install react react-dom @flanksource/clicky-ui

useTestRun — live test progress

The centerpiece is the useTestRun hook. Point it at a running gavel server and it subscribes to /api/tests/stream (SSE), falling back to polling /api/tests where EventSource is unavailable. It returns the latest full snapshot plus derived fields and the rerun/stop actions.

import { useTestRun } from '@flanksource/gavel/testrunner/hooks';

function TestProgress() {
  const { tests, status, statusText, done, error, rerun, stop } = useTestRun({
    baseUrl: 'http://localhost:8080', // your gavel server origin (or '' if same-origin)
  });

  if (error) return <p>{error}</p>;
  return (
    <div>
      <p>{statusText}</p>
      <ul>{tests.map(t => <li key={t.name}>{t.name}</li>)}</ul>
      {status.running && <button onClick={() => stop()}>Stop</button>}
      {done && <button onClick={() => rerun()}>Rerun all</button>}
    </div>
  );
}

Options

| Option | Default | Description | | --- | --- | --- | | baseUrl | window.__gavelBasePath ?? '' | API prefix, e.g. '', 'https://host', or '/results/{repo}/{id}'. | | basePath | — | Alias for baseUrl (parity with useTaskRun). | | enabled | true | Disable the subscription (e.g. before a target is known). | | pollMs | 2000 | Polling-fallback interval in ms. | | forcePoll | false | Force the polling transport even when EventSource exists. |

Result

{ snapshot, tests, lint, bench, status, statusText, runMeta, done, error, rerun, stop, refetch }. rerun(body?) POSTs to /api/rerun; stop(taskId?) POSTs to /api/stop (omit taskId for a global stop).

Components

The full UI is exported from @flanksource/gavel/testrunner:

import { App } from '@flanksource/gavel/testrunner';
import '@flanksource/clicky-ui/styles.css';

// Mount the complete testrunner UI; it reads window.__gavelBasePath for its API origin.
export default function Page() {
  return <App />;
}

Lower-level pieces are also exported for composing your own layout: Summary, TestNode, DetailPanel, FilterBar, ProgressBar, LintView, BenchView, DiagnosticsView, SplitPane, JsonView, AnsiHtml.

Types

All result and progress types (Test, Snapshot, SnapshotStatus, LinterResult, Violation, RunMeta, BenchComparison, ProcessNode, DiagnosticsSnapshot, RerunRequest, …) are exported from @flanksource/gavel/testrunner/types. They mirror the JSON gavel's handlers emit.

Styling

The components are styled with Tailwind utility classes and use Iconify web components (<iconify-icon>) for icons. Include Tailwind (or the clicky-ui stylesheet) and register the Iconify element in your host page, exactly as gavel's embedded page does.