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

fake-mocha

v0.1.0

Published

Run arbitrary commands instead of mocha to integrate with popular IDEs

Downloads

28

Readme

fake-mocha

Run arbitrary commands instead of mocha to integrate with popular IDEs

Install

npm install --save-dev fake-mocha

What? Why?

If you're developing for a production platform, chances are you're either currently running your tests in a production-like virtual machine, container, or remote dev server, or you should be.

Popular IDEs such as those in the JetBrains family -- IntelliJ IDEA, WebStorm, PHPStorm, PyCharm, etc., have excellent mocha integration for Node.js projects, provided by the optional NodeJS plugin. It provides a fantastic interface for running and exploring the results of tests, jumping right to errors or test definitions when they're clicked on.

The problem is, that mocha integration is local-only. There's no way to configure a remote run in a Docker container or a Vagrant VM, and so you're sunk if your tests require a local database, a specific version of Node.js, or some other production-like dependency.

Using fake-mocha, you can configure the mocha integration to look into node_modules/fake-mocha instead of node_modules/mocha, and in the "Extra Mocha options" section, tell it to execute your own test script. For example, if you'd prefer mocha to run make test, just set those extra options to --command "make test". Fake-mocha will ignore all the other arguments and just run the command you gave it. It will also set the working directory to your project root, pass through stdio, and exit with the same exit status code as the command it executed.

Getting the mocha integration working

Running a different command is only half the battle, and that's what fake-mocha solves for you. It's up to you to invoke actual mocha in your dev environment, and pass it the IntelliJ mocha reporter provided by the IDE plugin. See the examples folder for a Makefile that will do exactly that to run your tests in the official 'node' Docker container.

License

fake-mocha is licensed under the MIT license. Please see LICENSE.txt for full details.

Credits

fake-mocha was created in a flurry of frustration at TechnologyAdvice.