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

@mochify/cli

v0.4.1

Published

Run mocha tests in headless browsers from the command line

Downloads

223

Readme

Mochify CLI

Usage

Install the package from npm:

npm i @mochify/cli -D

which will make mochify command available:

mochify [options] <spec...>

Options

The Mochify CLI can pick up configuration from files or CLI flags. File config can be provided through package.json or in JavaScript or JSON files and is resolved using the default lookup mechanism specified by lilconfig. For example, you could either put configuration in a top-level mochify key in package.json for static values or a mochify.config.js for dynamic ones, and have them being picked up automatically. In case an option is present in both the config file and as a CLI flag, the flag takes precedence. Refer to the documentation of @mochify/mochify for available configuration options.

--config, -C

Override the default lookup and use the file as the source of configuration.

--driver, -D

The driver to use for running the tests. Drivers published to the @mochify scope can be referenced using their suffix only (e.g. puppeteer), third-party or local drivers will need to use the full package name or file path. Drivers need to be installed separately from the Mochify CLI.

--driver-option

Free form options to pass to the driver in use. Pass an arbitrary number of options using --driver-option.foo 1 --driver-option.bar 2. Refer to the documentation of the driver in use for available options.

--reporter, -R

The Mocha reporter to use. Right now, only reporters that are included with Mocha itself can be used.

--bundle, -B

The command used for bundling the given spec. The called executable is expected to be installed by the consumer. In case no bundle command is given and --esm is not used, spec files will be concatenated instead of bundling before running the test suite. The command will receive the resolved value of <spec...>.

--esm

Run a local web server and inject all files in the spec as <script type="module"> instead of bundling. The server serves the contents of the current working directory unless --serve is given, in which case the contents of the given location will be served instead.

--serve, -S

Run the tests in the context of a local web server. Files in the given directory will be served as static assets.

--server-option

Options to pass to the server in case --serve or --esm is being used. Currently only --server-option.port for passing the port to use is supported.

Spec

The spec argument can be a list of files or a glob pattern that will be resolved by Mochify.

mochify ./src/foo.test.js ./src/bar.test.js
mochify ./src/*.test.js # Let the shell handle glob expansion
mochify "./src/*.test.js" # Let Mochify handle glob expansion

Reading a bundle from stdin

When given - as the spec, Mochify expects to read a bundled test suite from stdin:

browserify -t babelify ./src/*.test.js | mochify -