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

fairsplice

v0.4.3

Published

**Warning: this project is still in very early development!**

Downloads

46,043

Readme

Fairsplice

Warning: this project is still in very early development!

Fairsplice is a CLI tool designed to optimize test distribution across multiple workers. By intelligently splitting and saving test cases, Fairsplice ensures a balanced workload distribution for your CI/CD pipelines, making tests run time more predictable.

We found Github Actions lacking when compared to CircleCI which has tests splitting based on timings.

There are a number of projects like Split tests but they require uploading and downloading Junit XML files and merging them, or committing the Junit files to have them when running the tests.

This tool uses instead a Redis server to store the last 10 timings for each test file and uses the average of these to split tests. It is easy to setup if you have a Redis server running.

Installation

This project is built using Bun and Redis.

Ensure you have Bun installed. To launch it, run

bunx fairsplice

Configuration

Before using Fairsplice, set the environment variable FAIRSPLICE_REDIS_URL to your Redis server URL. This is necessary for storing and retrieving test case information.

export FAIRSPLICE_REDIS_URL='redis://myuser:[email protected]:33683'

Usage

Fairsplice supports two main commands: save and split.

Saving test results

To save test results:

fairsplice save --from <file>
  • --from <file>: Specify the file path to read test results from.

Example:

fairsplice save --from results/junit.xml

Splitting test cases

To split test cases for execution:

fairsplice split --pattern "<pattern>" [--pattern "<anotherPattern>" ...] --total <total> --out <file> --replace-from <string> --replace-to <string> [--replace-from <other> --replace-to <other>]
  • --pattern "<pattern>": Pattern to match test files. Can be used multiple times to specify multiple patterns.
  • --total <total>: Total number of workers in the test environment.
  • --out <file>: File to write split test files to (newline separated)
  • --replace-from <string>: Substring to replace in the file paths (can be used multiple times)
  • --replace-to <string>: Replacement for the substring (can be used multiple times but must match the number of --replace-from)

Example:

fairsplice split --pattern "test_*.py" --pattern "tests*.py" --total 3 --out split.json

Help

For a detailed list of commands and options, use the help command:

fairsplice --help

Contributing

Contributions are welcome! Please fork the repository and submit a pull request with your improvements.

Running locally

Launch the development version with:

bun run index.ts

Running tests

Launch the following command to run tests:

bun test [--watch]

License

Fairsplice is open-source software licensed under the MIT license.