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

@agentable/vitest-config

v0.6.0

Published

Shared Vitest presets for Fleet-family TypeScript libraries, DOM tests, Browser Mode, and packed artifacts.

Readme

@agentable/vitest-config

Shared Vitest 5 presets for source, DOM, browser, and packed-artifact tests.

Installation

pnpm add -D @agentable/vitest-config vitest vite

Test a library

import { libraryPreset } from "@agentable/vitest-config";
import { defineConfig } from "vitest/config";

export default defineConfig({
  test: { ...libraryPreset },
});

libraryPreset uses Node.js and prepares source coverage globs; coverage is opt-in. Type-test collection and the test tsconfig remain owned by the consumer, which can run vitest run --typecheck.only with its real project config.

Test DOM behavior

Install jsdom, then use domPreset for React hooks, components, or other lightweight DOM behavior.

pnpm add -D jsdom
import { domPreset } from "@agentable/vitest-config";
import { defineConfig } from "vitest/config";

export default defineConfig({
  test: {
    ...domPreset,
    setupFiles: ["./src/test/setup.ts"],
  },
});

Test in a real browser

Install the Playwright provider and pass the provider plus browser instances to browserPreset.

pnpm add -D @vitest/browser-playwright playwright
pnpm exec playwright install chromium
import { browserPreset } from "@agentable/vitest-config";
import { playwright } from "@vitest/browser-playwright";
import { defineConfig } from "vitest/config";

export default defineConfig({
  test: {
    ...browserPreset({
      provider: playwright(),
      instances: [{ browser: "chromium" }],
    }),
    include: ["src/**/*.browser.test.ts"],
  },
});

Use --browser.headless in CI. Browser lifecycle and isolation remain owned by Vitest and the provider.

Collect coverage

Install the coverage provider at the same version as Vitest, then enable coverage explicitly. For Vitest 5.0.3:

pnpm add -D @vitest/[email protected]
pnpm exec vitest run --coverage

The source presets select src/**/*.{js,jsx,ts,tsx}, excluding declarations, tests and mocks. V8 is Vitest's default provider and supports Node.js and Chromium; Firefox and WebKit require the matching @vitest/coverage-istanbul package and coverage.provider: "istanbul".

With test.projects, configure coverage on the root test.coverage; project-level coverage options are ignored. Set coverage.include relative to that root, for example packages/*/src/**/*.{js,jsx,ts,tsx} for a workspace. Inline projects inherit root configuration, and arrays such as setupFiles are merged. Keep artifact checks in a separate run so source coverage, aliases and setup do not carry into them.

Test packed artifacts

Use artifactPreset at the root of a standalone config in a workspace that installs and imports final tarballs. Run that config independently with vitest run --config vitest.artifact.config.ts. Do not add source aliases or source coverage to this run; nesting it under a source run cannot disable the root's coverage.

// vitest.artifact.config.ts
import { artifactPreset } from "@agentable/vitest-config";
import { defineConfig } from "vitest/config";

export default defineConfig({
  test: {
    ...artifactPreset,
    include: ["**/*.artifact.test.ts"],
  },
});

Presets

| Preset | Environment | Project name | Coverage | | ------------------------ | ------------ | ------------ | --------------------- | | libraryPreset | Node.js | Consumer | Source globs, opt-in | | domPreset | jsdom | Consumer | Source globs, opt-in | | browserPreset(options) | Browser Mode | Consumer | Source globs, opt-in | | artifactPreset | Node.js | artifact | Disabled (standalone) |

Presets keep Vitest's explicit-import, parallel, reporter, timeout, and mock-lifecycle defaults. Vitest 5 clears mock call history before each test while retaining implementations, uses exact browser locators, and shares the Vite server for eligible inline projects by default.

The Node, DOM and artifact presets disable CommonJS variable injection into ES modules. Use native ESM APIs such as import.meta.dirname, or createRequire for explicit CommonJS loading. CommonJS modules retain their own module scope.

Use vitest doctor on the consumer's real suite before selecting a pool or enabling fsModuleCache. Browser tracing is opt-in through browserPreset({ provider, instances, traceView: true }); it adds no separate shared API or default recording cost.

Keep optional Vitest providers, coverage packages, and the runner on matching versions. Vitest 5 requires Vite as a host peer; its version range is declared by Vitest.

License

This project is licensed under the MIT License - see the LICENSE file for details.