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

@zeit/best

v0.7.3

Published

Bare testing framework

Downloads

383

Readme

Best

Best is a bare test runner. It looks for test sources, finds exported functions, and runs them - without requiring any imports or exposing any globals.

All functions are awaited upon, but run in series.

Installation

Best can be installed with either yarn or npm.

$ yarn add --dev @zeit/best
$ npm install --save-dev @zeit/best

Usage

  best

  A dead simple test runner.

  - Export your functions and they're evaluated
  - Function names become test names
  - Exported functions are awaited upon

  USAGE

    best --help
    best [-I /dir/or/file [-I ...]] [-T] [test_name...]

    test_names's correspond to the name of the exported functions within test sources,
    and are prefixed with the path of the source file (sans extension) in which it was defined.

    For example, the following test function inside test/foo.js:

        exports.my_example_test = async () => {
            assert(foo === bar);
        };

    would translate to the test_name:

        test/foo/my_example_test

    Specify one or more (optional) test_name's to only run certain tests (or prefix
    with - to skip the named test).

  OPTIONS

    --help                          Shows this help message

    -v, --verbose                   Shows more verbose test results

    -I, --include /dir/or/file      Uses one or more directories/files as test sources.
                                    Defaults to ./test/**/*.js if no include directives
                                    are specified

    -r, --require module-name       Imports a module or a script prior to running tests

Typescript

To use with Typescript, install ts-node and esm and register them.

$ npm install --save-dev ts-node esm
$ best -r esm -r ts-node

NOTE: esm must come before ts-node!

Debugging Hangs

Best does not have a built-in timeout for tests in order to remain as unopinionated as possible. Due to this, hangs may occur from time to time.

Using why-is-node-running, we can detect hangs and see what caused them:

$ npm install --save-dev why-is-node-running
$ best -r why-is-node-running/include
...
$ pkill -USR1 node

Sending SIGUSR1 to the process will cause why-is-node-running to dump statistics about remaining (ref'd) handles to the TTY of the node process itself.

License

Best is copyright © 2018-2019 by ZEIT, Inc. and released under the MIT License.