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

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -