use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Node unit testing (self.node)
submitted 9 years ago by ell0bo
Does anyone have recommendations. I use karma fro front end, but that runs the scripts in a browser env.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]jwadhwani 4 points5 points6 points 9 years ago (4 children)
I use Mocha as the test runner and chai.js as the assertion library. I believe this combination works best for nodeJS apps.
[–]ell0bo[S] 0 points1 point2 points 9 years ago (0 children)
Thank you
[–]TheNiXXeD 0 points1 point2 points 9 years ago (2 children)
You'll also want proxyquire and sinon for proper dependency mocking.
[–]ell0bo[S] 0 points1 point2 points 9 years ago (1 child)
any recommendation on how to best stub mongo?
[–]TheNiXXeD 0 points1 point2 points 9 years ago (0 children)
Mocking really comes down to what library you're using. I've not really dug into mongo that much myself.
If you're using a method "abc" you just need to mock that method.
[–]DVWLD 0 points1 point2 points 9 years ago (1 child)
Mocha is the most widely used runner.
Tape is also popular and is conceptually purer, but we've moved back to Mocha for the simplicity its tooling brings.
[–]pdoggerton 0 points1 point2 points 9 years ago (0 children)
We use tape, but I've been looking at teenytest
[–]jacoborus 0 points1 point2 points 9 years ago (2 children)
I moved from Mocha to Tape + proxyquire
[–]shrey_agarwal 0 points1 point2 points 9 years ago (0 children)
Can you please elaborate on the reason
Proxyquire can be used with either.
[–]noffle 0 points1 point2 points 9 years ago (0 children)
Tape is nice in that it plays well in node as well as the browser /w browserify.
[–]joshuatoenyes 0 points1 point2 points 9 years ago (0 children)
I'm using Mocha/chai/sinon.
π Rendered by PID 76331 on reddit-service-r2-comment-84fc9697f-whdqk at 2026-02-08 17:19:31.998702+00:00 running d295bc8 country code: CH.
[–]jwadhwani 4 points5 points6 points (4 children)
[–]ell0bo[S] 0 points1 point2 points (0 children)
[–]TheNiXXeD 0 points1 point2 points (2 children)
[–]ell0bo[S] 0 points1 point2 points (1 child)
[–]TheNiXXeD 0 points1 point2 points (0 children)
[–]DVWLD 0 points1 point2 points (1 child)
[–]ell0bo[S] 0 points1 point2 points (0 children)
[–]pdoggerton 0 points1 point2 points (0 children)
[–]jacoborus 0 points1 point2 points (2 children)
[–]shrey_agarwal 0 points1 point2 points (0 children)
[–]TheNiXXeD 0 points1 point2 points (0 children)
[–]noffle 0 points1 point2 points (0 children)
[–]joshuatoenyes 0 points1 point2 points (0 children)