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

@kormanowsky/test-sequencer

v0.2.0

Published

A set of test sequencers to use with TS/JS test frameworks

Downloads

66

Readme

Test-sequencer

This package provides test sequencers which shard tests with respect to their estimated run duration. Durations are to be collected by the test framework such as Jest and to be extracted from the framework's cache. When received, tests are distributed into groups by using distribObjects() function from @kormanowsky/distrib package. The resulting groups are used as groups of tests for each shard. Note: there may be less groups than available shards, so some shards may receive no tests to run.

Usage

  1. Install this package by running npm install -D @kormanowsky/test-sequencer.
  2. Follow the instructions below depending on which test framework you are using.

Common notes

When you run the tests, a file named kts-cache.json is created in your project's root directory. Don't forget to cache it on CI and add it to your .gitignore file.

Important: when sharded, tests produce several cache files named kts-cache.json maybe inside different run contexts (CI jobs, build machines etc). It is your task to collect and merge them all after all the shards finish and all the files are generated. You may use npx kts merge-cache kts-cache.json kts-cache*.json to fulfil this task. This is similar to how you create one test coverage report for your sharded tests. You should make kts-cache.json available to all the shards before the next run of the tests.

Jest

Add the following to your jest.config.js:

module.exports = {
    // ...
    testSequencer: "@kormanowsky/test-sequencer/jest"
    // ...
}

Example: is provided inside examples/jest directory.

Playwright

Use npx kts-pw instead of npx playwright. This file will shard tests and run npx playwright test, passing all arguments to Playwright. Shard index and total shards count must be set as KTS_PW_SHARD_INDEX and KTS_PW_SHARD_TOTAL, respectively. Do not use --shard=... for this purpose.

Example: is provided inside examples/playwright directory.