node.js - Where i should keep my libs for testing with mocha in nodejs? -


i need test nodejs module, writes data output. wrote debugstream stream collect output data assert later:

function debugstream () {   stream.writable.call(this);   this.data = ''; }; util.inherits(debugstream, stream.writable);  debugstream.prototype._write = function (chunk, encoding, done) {   this.data += chunk;   done(); }  debugstream.prototype.getdata = function () {   return this.data; } 

i not want write code in every test file. nice move away somewhere, can't how organize it. can't place in test/ folder, because mocha think it's test.

how that?

under tests can create folders , node modules, treat tests subproject in folder required modules , tools, check example:

https://github.com/edsadr/change-api/tree/master/test


Comments

Popular posts from this blog

javascript - Can Piwik report referrer in real time? -

asp.net - Google Drive Access: At least one client secrets (Installed or Web) should be set -

excel vba add hyperlink to shape in group -