Mocha
Disable Timeout
mocha <your file> --no-timeouts
Testing iteration with Mocha
npm install it-each
https://zackehh.com/asynchronous-test-loops-with-mocha/
Enable log by using debug package
var debug = require('debug');
var logger = debug('<your debug token>')
pass DEBUG env variable as your file name
----for mac---
DEBUG=<your file name> mocha test/test.js
----for windows----
mocha test/test.js DEBUG=<your debug token>
Run test after db connection ready
Use beforeEach or before
before(function(done){ MongoClient.connect(url, function(err, db) { assert.equal(null, err); console.log("Connected successfully to server"); dbInstance = db; done(err) }); })
Last updated
Was this helpful?