Skip to content

Latest commit

 

History

History
43 lines (25 loc) · 1.81 KB

Using_with_mocha_loaders.md

File metadata and controls

43 lines (25 loc) · 1.81 KB
title
Using with mocha loaders

Using with mocha loaders

There are a few modules that invoke Mocha as a dependency, such as:

Getting 3rd-party mocha addons like mocha-clean aren't always straight-forward, and the --require mocha-clean argument will not always work. Fortunately, there are work-arounds based on npm dedupe (docs).

Using mocha-clean with gulp

  1. Use gulp-spawn-mocha. Do not use gulp-mocha.

  2. Add in the test/mocha.opts file as originally prescribed in mocha-clean.

Using mocha-clean with grunt

NB: these instructions aren't tested thoroughly, YMMV.

  1. Ensure that mocha and mocha-clean are part of your main project's package.json devDependencies.

  2. If you have a npm-shrinkwrap.json file, be sure to install mocha and mocha-clean via npm install, then re-invoke npm shrinkwrap. (docs)

  3. Run npm dedupe. This makes grunt-mocha use the same top-level mocha package.

  4. Add require('mocha-clean') in the top-level scope of your Gruntfile.js. This patches the top-level mocha package.

  5. Use grunt-mocha as usual. mocha-clean should now work.

Related issue: #3

Using mocha-clean with karma

Same as above, but add require('mocha-clean') to your karma.conf.js.

Related issue: #5