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

symfony - InvalidConfigurationException in SecurityExtension.php line 429: No authentication listener registered for firewall "secured_area" -

angular ui router - 10 digest iterations reached in angularjs when using $state.go -

javascript - Handling constructor related functions while testing with mocha and sinon -