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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@knapsack-pro/vitest

v0.1.2

Published

Knapsack Pro Vitest splits Vitest tests across CI nodes and makes sure that tests will run in optimal time on each CI node.

Downloads

157

Readme

@knapsack-pro/vitest


Knapsack Pro wraps Vitest and works with your existing CI infrastructure to parallelize tests optimally:

  • Dynamically splits your tests based on up-to-date test execution data
  • Is designed from the ground up for CI and supports all of them
  • Tracks your CI builds to detect bottlenecks
  • Does not have access to your source code and collects minimal test data
  • Enables you to export historical metrics about your CI builds
  • Replaces local dependencies like Redis with an API and runs your tests regardless of network problems

Getting Started

  1. Install the package
npm install @knapsack-pro/vitest
  1. Update your CI to use a matrix build. See the example workflow for reference.
  2. Replace vitest with @knapsack-pro/vitest in your CI config
  3. Set the KNAPSACK_PRO_TEST_SUITE_TOKEN_VITEST environment variable to your Knapsack Pro test suite token, and optionally set other environemnt variables as needed.

Environment variables

Below are the primary environment variables you may need to set to use Knapsack Pro with Vitest. For a full list of environment variables, see Knapsack Pro Jest.

KNAPSACK_PRO_TEST_SUITE_TOKEN_VITEST (Required)

The API token you receive when creating a new Test Suite in Knapsack Pro. This authenticates your test suite with our API.

KNAPSACK_PRO_TEST_FILE_PATTERN (Optional)

A glob pattern to specify which test files to run. If not provided, uses the vitest configuration file

KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN (Optional)

A glob pattern to specify which test files to exclude. If not provided, uses the vitest configuration file.

KNAPSACK_PRO_COVERAGE_DIRECTORY (Optional)

The directory where coverage reports will be saved. If not provided, uses the vitest configuration file.

KNAPSACK_PRO_CI_NODE_TOTAL (Required)

The total number of parallel CI nodes you're running. For example, if you're running tests across 4 machines, this should be set to 4.

KNAPSACK_PRO_CI_NODE_INDEX (Required)

The index of the current CI node (0-based). For example, if you're running on 4 machines, each machine should have a unique index from 0 to 3.

KNAPSACK_PRO_LOG_LEVEL (Optional)

Controls the verbosity of logs

Dependencies

Contributing

Follow the steps in the root README.md to set up the project.

You can compile TypeScript in watch mode from the root folder with:

npm start -w packages/vitest

Testing

To test @knapsack-pro/vitest against a real test suite we use:

Publishing

See Publishing in the root README.md.