Skip to content Skip to sidebar Skip to footer

Node.js - Why Do I Get Leaks When Testing With Mocha And Zombie?

I've tried to make zombie work with mocha, but unless I use the mocha --ignore-leaks command options, my test always fails with the error: Error: global leaks detected: k, i, name,

Solution 1:

The leaks can come either from your own code or from node_modules that you use. Mocha should give some hints on where the leaks are, such as forgetting to declare local variable with var.

// global leaks
a = 1;

// no leaksvar a = 1;

You might also be interested writing Node.js app in coffeescript since it helps you avoid mistakes like that. (It automatically initializes variables, using var) http://coffeescript.org/

There is a template that helps you get started here https://github.com/twilson63/express-coffee

Post a Comment for "Node.js - Why Do I Get Leaks When Testing With Mocha And Zombie?"