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

mocha-watch-typeahead

v0.0.2

Published

Interactive watch mode support for the mocha test framework.

Downloads

3

Readme

mocha-watch-typeahead

npm

The mocha-watch-typeahead is an attempt to add interactive watch mode support for the Mocha test framework. Besides rerunning tests on file changes, it provides a feature to filter tests by file name.

mocha-watch-typeahead in action

Install

npm install [email protected] mocha-watch-typeahead -D --save-exact

The mocha-watch-typeahead uses some internal methods from [email protected], So at the moment it directly depends on [email protected] (the latest version at the time of writing).

Usage

First, you have to configure the mocha. For that, please refer to its getting start guide. Then add the following npm script to the package.json.

{
  "scripts": {
    "test-watch": "mocha-watch"
  }
}

Think mocha-watch is an alias for command mocha. You can pass all valid mocha options to the mocha-watch as well. The only difference is, it always runs in watch mode.

npm run test-watch

Based on your mocha configuration, it collects all the matched test files and prompt autocomplete to filter tests by file name. You can filter tests by glob pattern as well.

filter mode

Note, the above list won't display files that are loaded through the --file option.

Temporary limitations

The mocha-watch-typeahead has a few known temporary limitations at the moment.

  • It only tested with the latest version of mocha v8.1.3. Probably it won't work with the older versions of mocha.
  • It only supports serial run, although mocha's built-in watch mode has support for parallel run.
  • It doesn't validate passed options.

If you encounter the following warning message in watch mode, you can safely ignore it. It's a known mocha issue.

MaxListenersExceededWarning: Possible EventEmitter memory leak detected.
11 uncaughtException listeners added to [process]. Use emitter.setMaxListeners() to increase limit

Future improvements

  • [ ] Watch mode feedback speed can be increased by not watching non-filter test files.
  • [ ] Resolve the temporary limitations.

Credits

License

MIT © Sureshraj