Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

how to run unit tests with better-assert and mocha?

how to run unit tests with better-assert and mocha?

Problem

I'm trying to run some unit tests with Mocha + better-assert but better-assert uses an undefined variable __stack, and so it throws a reference error.

I'm new to the entire node.js stack, and despite some searching I'm not able to find out if this __stack variable is something that comes from the v8 runtime, or from node.js, or mocha, or something else. grepping hasn't been fruitful.

using node v0.8.18, mocha 1.8.1, better-assert 0.1.0

where is the __stack variable defined?

Problem courtesy of: goat

Solution

TJ Holowaychuk, the author of better-asset, just updated it with a fix for this exact problem. And by "just" I mean within an hour of you posting your question! If you update to the latest version of the module you shouldn't get the error any more.

Here are the details of the change if you are interested.

Solution courtesy of: matthewtole

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

how to run unit tests with better-assert and mocha?

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×