Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@knapsack-pro/vitest

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@knapsack-pro/vitest

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

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@knapsack-pro/vitest

Knapsack Pro

Speed up your tests

Run your 1-hour test suite in 2 minutes with optimal parallelisation on your existing CI infrastructure




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.

Keywords

FAQs

Package last updated on 14 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc