mocha-mongoose-fix-overwitemodelerror
v1.0.0
Published
FIX Mongoose issue #1251 with mocha in watch mode
Downloads
2
Readme
mocha-mongoose-fix-overwitemodelerror
Fixes Mongoose issue #1251 with mocha in watch mode
Works best with mocha --require=env-test
.
Why?
When you use Mongoose and run your tests with mocha --watch
, on each reload you may encounter a fatal OverwriteModelError
error.
How?
- Install with
npm install --save-dev mocha-mongoose-fix-overwitemodelerror
- Edit
test/mocha.opts
and add the line--require=mocha-mongoose-fix-overwitemodelerror
This will ensure mocha models are properly (or brutally) reset before relaunching tests.