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

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -