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

@theholocron/vitest-config

v7.19.1

Published

Vitest configuration presets for libraries, React apps, and Storybook within the Galaxy.

Readme

Vitest Config

A Vitest configuration with presets for Node.js libraries, React apps, and Storybook within the Galaxy.

Installation

pnpm add -D @theholocron/vitest-config

Usage

Presets are designed for use with Vitest's projects array, which runs unit and component tests in separate environments. Coverage is configured at the root test level and applies across all projects.

import { coverage, react, storybook } from "@theholocron/vitest-config";
import { defineConfig } from "vitest/config";

export default defineConfig(async () => ({
  test: {
    coverage: {
      ...coverage,
      exclude: [...coverage.exclude, "**/mocks/**"],
    },
    projects: [react({ name: "unit" }), await storybook(".storybook", { setupFiles: ["./vitest.setup.ts"] })],
  },
}));

Node.js library or CLI tool

import { node } from "@theholocron/vitest-config";
import { defineConfig } from "vitest/config";

export default defineConfig(node());

React component library or app

Requires jsdom, @testing-library/react, and @testing-library/jest-dom as peer dependencies. The react preset automatically adds @testing-library/jest-dom to setupFiles — no manual import needed.

import { react } from "@theholocron/vitest-config";
import { defineConfig } from "vitest/config";

export default defineConfig(react());

Storybook component tests

Requires @storybook/addon-vitest and playwright as peer dependencies.

import { storybook } from "@theholocron/vitest-config";
import { defineConfig } from "vitest/config";

export default defineConfig(await storybook(".storybook"));

Coverage defaults

The coverage export provides standard coverage configuration (v8 provider, text + lcov reporters, vitest's default excludes). Extend it with project-specific excludes:

import { coverage } from "@theholocron/vitest-config";

// in vitest.config.ts
coverage: {
  ...coverage,
  exclude: [...coverage.exclude, "**/handlers.*", "**/*.mock.*"],
}

MSW setup helpers

Use setupMSWBrowser and setupMSWNode from @theholocron/vitest-config/setup/msw to wire MSW lifecycle hooks. Pass optional Storybook annotations to ensure annotations.beforeAll runs before the worker starts.

Browser (Storybook / Playwright)

// vitest.setup.ts
import { setProjectAnnotations } from "@storybook/react";
import { setupMSWBrowser } from "@theholocron/vitest-config/setup/msw";
import * as preview from "./.storybook/preview";
import { worker } from "./src/mocks/browser";

const annotations = setProjectAnnotations([preview]);
setupMSWBrowser(worker, annotations);

Node (unit tests)

// vitest.setup.ts
import { setupMSWNode } from "@theholocron/vitest-config/setup/msw";
import { server } from "./src/mocks/node";

setupMSWNode(server);

Bundles

Bundles combine a preset with opinionated coverage settings (80% threshold on all metrics via @vitest/coverage-v8).

Library bundle

import { library } from "@theholocron/vitest-config/bundles/library";
import { defineConfig } from "vitest/config";

export default defineConfig(library());

React app bundle

import { reactApp } from "@theholocron/vitest-config/bundles/react-app";
import { defineConfig } from "vitest/config";

export default defineConfig(reactApp());

How We Test

We use Vitest as our testing framework with the following conventions:

  • Coverage: enforced at 80% on lines, branches, functions, and statements via @vitest/coverage-v8
  • File naming: test files use the .test.{js,ts} or .spec.{js,ts} suffix, co-located with source
  • Stories excluded: *.{story,stories}.* files are excluded from unit test runs; use the storybook preset for those