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

@jmlweb/vitest-config

v3.0.2

Published

Base Vitest configuration for jmlweb projects with TypeScript support and coverage settings

Readme

@jmlweb/vitest-config

npm version License: MIT Node.js Vitest

Base Vitest configuration with TypeScript-friendly defaults, v8 coverage and 80% thresholds.

✨ Features

  • 📊 Coverage: v8 provider with 80% thresholds
  • 🎯 Sensible defaults: Node environment, globals enabled, verbose reporter
  • ⚡ Fast: thread pool by default
  • 🔀 Dual format: ESM and CommonJS builds

📦 Installation

npm install --save-dev @jmlweb/vitest-config vitest @vitest/coverage-v8

@vitest/coverage-v8 is needed for --coverage; use the same version as vitest.

💡 Upgrading? See the Migration Guide.

🚀 Quick Start

// vitest.config.ts
import { defineConfig } from 'vitest/config';
import baseConfig from '@jmlweb/vitest-config';

export default defineConfig({
  ...baseConfig,
});

Everything lives under test. A test key in your config replaces the whole base test block, so spread ...baseConfig.test into it, or use mergeConfig:

import { defineConfig, mergeConfig } from 'vitest/config';
import baseConfig from '@jmlweb/vitest-config';

export default mergeConfig(
  baseConfig,
  defineConfig({ test: { environment: 'jsdom' } }),
);

💡 Examples

Overrides

import { defineConfig } from 'vitest/config';
import baseConfig from '@jmlweb/vitest-config';

export default defineConfig({
  ...baseConfig,
  test: {
    ...baseConfig.test,
    environment: 'jsdom',
    setupFiles: ['./src/test/setup.ts'],
    testTimeout: 10000,
  },
});

Custom coverage thresholds

import { defineConfig } from 'vitest/config';
import baseConfig from '@jmlweb/vitest-config';

export default defineConfig({
  ...baseConfig,
  test: {
    ...baseConfig.test,
    coverage: {
      ...baseConfig.test?.coverage,
      thresholds: { lines: 90, functions: 90, branches: 85, statements: 90 },
    },
  },
});

Explicit imports, no thresholds

Import describe, it and expect yourself and report coverage without failing the run:

import { defineConfig } from 'vitest/config';
import baseConfig from '@jmlweb/vitest-config';

export default defineConfig({
  ...baseConfig,
  test: {
    ...baseConfig.test,
    globals: false,
    coverage: { ...baseConfig.test?.coverage, thresholds: {} },
  },
});

📋 Configuration Details

| Setting | Value | | ----------------------------- | ------------------------------------------------------------ | | globals | true | | environment | 'node' | | testTimeout / hookTimeout | 5000 / 10000 ms | | pool | 'threads' | | reporters | ['verbose'] | | include | **/*.{test,spec}.{ts,tsx,js,jsx} | | exclude | node_modules, dist, build, dot-dirs, tool config files | | coverage.provider | 'v8' | | coverage.thresholds | 80 for lines, functions, branches, statements | | coverage.include | src/**/*.{ts,tsx,js,jsx} | | coverage.reporter | ['text', 'json', 'html'] |

Coverage excludes *.d.ts, *.config.{ts,js}, dist, build, node_modules, coverage, and test/spec files.

🎯 When to Use

  • ✅ Vitest-based TypeScript projects
  • ✅ Enforced coverage with a shared baseline
  • ✅ Node.js libraries, CLIs and APIs, or browser code with environment: 'jsdom'

Not for you if you use Jest: see @jmlweb/jest-config (maintenance mode).

🔧 Extending the Configuration

Spread baseConfig.test and override what you need (see Examples). Install jsdom or happy-dom yourself when you set environment to either.

📝 Usage with Scripts

{
  "scripts": {
    "test": "vitest",
    "test:run": "vitest run",
    "test:coverage": "vitest run --coverage",
    "test:typecheck": "vitest typecheck"
  }
}
npm test                  # watch mode
npm run test:coverage     # single run with coverage

Type checking is not part of the config: run vitest typecheck separately.

📋 Requirements

  • Node.js >= 22.12.0
  • Vitest >= 1.0.0 (config targets Vitest 4)

📦 Peer Dependencies

  • vitest (>=1.0.0)

🔗 Related Packages

🔄 Migration Guide

2.x to 3.0

Breaking: Node.js >= 22.12.0 is required.

  1. Upgrade Node.js to 22.12.0 or later.
  2. Update: npm install --save-dev @jmlweb/vitest-config@latest

1.x to 2.0

Vitest 4: poolOptions.threads.minThreads and maxThreads are gone; Vitest manages the pool automatically.

See the Changelog for details.

📄 License

MIT