title |
---|
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).
-
Use gulp-spawn-mocha. Do not use gulp-mocha.
-
Add in the
test/mocha.opts
file as originally prescribed in mocha-clean.
NB: these instructions aren't tested thoroughly, YMMV.
-
Ensure that
mocha
andmocha-clean
are part of your main project's package.json devDependencies. -
If you have a
npm-shrinkwrap.json
file, be sure to installmocha
andmocha-clean
vianpm install
, then re-invokenpm shrinkwrap
. (docs) -
Run
npm dedupe
. This makesgrunt-mocha
use the same top-levelmocha
package. -
Add
require('mocha-clean')
in the top-level scope of your Gruntfile.js. This patches the top-levelmocha
package. -
Use grunt-mocha as usual. mocha-clean should now work.
Related issue: #3
Same as above, but add require('mocha-clean')
to your karma.conf.js.
Related issue: #5