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

@pruner/cli

v2.2.0

Published

The Pruner CLI that reduces the amount of time spent running tests.

Downloads

21

Readme

Downloads

What is this?

Pruner is a universal test CLI that does the following:

  • Runs your tests as soon as the code updates.
  • Only runs the tests that are needed (the tests that run through the code you changed).
  • Highlights code coverage with test status next to each line (see video below), so you know if you broke something, as you write it.
  • Runs on your build server as well. Avoid wasting time waiting for your build server to run tests you already ran locally.
  • Allows you to split tests in several chunks, useful for running tests in parallel across machines on a build server.

Optional: Get the Visual Studio extension

  • Visual Studio Code: https://marketplace.visualstudio.com/items?itemName=Pruner.vscode
  • Visual Studio: https://marketplace.visualstudio.com/items?itemName=Pruner.vs

Watch a demo-video

Getting started

First you need to install the CLI. This requires Node installed.

npm i @pruner/cli -g

Language & framework support

Pruner supports several languages and frameworks. Pick the instructions for the language you want to use, to get started.

Note: If you are only using Pruner for test-splitting and don't want to split based on timing data, all languages are supported out of the box, and no setup is required.

dotnet (C# .NET, VB .NET)

Instructions: https://github.com/pruner/cli/blob/main/docs/dotnet.md

mocha (JavaScript)

Instructions: https://github.com/pruner/cli/blob/main/docs/mocha.md

Looking for more providers?

File an issue or feel free to submit a pull request!

Running tests

When you want to run your affected tests, use:

pruner run

Watch mode

There's also a watch mode available, which will automatically run affected tests as you save files in your projects:

pruner run --watch

Splitting tests

The syntax for splitting tests is pruner split <total-chunks> <chunk-offset> <glob-pattern>.

  • <total-chunks> is the amount of total chunks you want to split your tests in.
  • <chunk-offset> the zero-based chunk index to keep on disk.
  • <glob-pattern> the glob-pattern for your tests.

Example

Let's say you have the following files in your repository:

tests/BarTest.cs
tests/BuzTest.cs
tests/FooTest.cs
tests/FuzTest.cs
tests/Helpers.cs
tests/SomeOtherFile.cs

If you then run the command pruner split 2 0 "**/*Test.cs", Pruner will split your tests in 2 chunks, and only keep chunk 0 (the first chunk) on the disk:

tests/BarTest.cs
tests/BuzTest.cs
tests/Helpers.cs
tests/SomeOtherFile.cs

If you instead run the command pruner split 2 1 "**/*Test.cs" Pruner will split your tests in 2 chunks, but instead keep chunk 1 (the second chunk) on the disk:

tests/FooTest.cs
tests/FuzTest.cs
tests/Helpers.cs
tests/SomeOtherFile.cs

GitHub Actions

See the build that triggers automatically on each push here: https://github.com/pruner/cli/blob/main/.github/workflows/split.yml

Splitting by timing data

By default, the tests are split based on the file count (an even file count on each chunk). If you want to split by timing data, you can do the following: pruner split <total-chunks> <chunk-offset> <glob-pattern> --by timings

This requires that you have run pruner run before, and committed your Pruner state file into GIT, so that Pruner has historic timing data to work with.

Comparison with other tools

As an alternative to NCrunch

NCrunch:

  • Does not offer a free version. Pruner is free.
  • Has not open-sourced their code. Pruner is fully open source.
  • Only runs in Visual Studio. Pruner runs in Visual Studio Code as well, or on your build server.
  • Does not remember your test state. Every time you reboot your machine, you have to re-run all tests again. Pruner persists your state to the disk, so that you can resume where you left off.

As an alternative to WallabyJS

WallabyJS:

  • Does not offer a free version (except for Open Source projects). Pruner is free.
  • Does not run other languages than JavaScript. Pruner supports several languages, and can combine all your test runs across technologies and frameworks in a single command.
  • Does not remember your test state. Every time you reboot your machine, you have to re-run all tests again. Pruner persists your state to the disk, so that you can resume where you left off.
  • Does not run on your build server. Pruner runs on your build server, allowing you to save time running tests there as well.

As an alternative to DotCover

DotCover:

  • Does not offer a free version (except for Open Source projects). Pruner is free.
  • Does not run other languages than dotnet (C#, VB). Pruner supports several languages, and can combine all your test runs across technologies and frameworks in a single command.
  • Does not remember your test state. Every time you reboot your machine, you have to re-run all tests again. Pruner persists your state to the disk, so that you can resume where you left off.
  • Does not run on your build server. Pruner runs on your build server, allowing you to save time running tests there as well.

Contributing

To contribute, you need to have the following installed:

  • .NET SDK 5 (https://dotnet.microsoft.com/download)
  • Global install of the NPM package mocha (npm i mocha -g)