HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
mochajs
mocha
JavaScript2011–2024
mochajs / mocha

mocha

☕️ Classic, reliable, trusted test framework for Node.js and the browser

15Distinct people
15Mentions
0Explicit recommenders
22.9KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

☕️ Classic, reliable, trusted test framework for Node.js and the browser

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year15 dated mentions

Observed mentions: 2011-11-23 21:49:57 UTC to 2024-09-09 08:47:04 UTC.

01232011-01-01 00:00:00 UTC to 2012-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments20112012-01-01 00:00:00 UTC to 2013-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2024

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20112011-01-01 00:00:00 UTC2012-01-01 00:00:00 UTC110
20122012-01-01 00:00:00 UTC2013-01-01 00:00:00 UTC303
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC211
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC303
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC101
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC110
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC000
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC000
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC000
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC000
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC000
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC211
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC000
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC211

What Hacker News says

15 sources
tape is a good pick, thanks! i've been using mocha, just b/c it's the most popular, and tho it's not bad, i dislike that even in programmatic[.] usage, one generally doesn't import tests as a "module" object. somehow it just doesn't jibe w/ notions of code reuse, even if it hasn't become much of a problem in practice. anyway, i got curious about how to do this, started reading the source, and at a cursory glance, it looked like reading in tests as files was baked in pretty deep. [.]https://github.com/mochajs/mocha/wiki/Using-mocha-programmat...
In From Karma to Mocha, with a taste of jsdom
This is a really interesting analysis. From these graphs we could come up with some reasonable boundaries. Packages that: - have more than one version: 71853 - are over two weeks old: 42106 - had a new release in the last 360 days: 71277 There are 31888 packages satisfying all three conditions above. Though it’s only one third of all packages there, the amount is still enormous. Now, if only I could search those 31,888 packages on NPM alone if I wanted to. EDIT: By the way, for anybody reading this article not familiar with the JavaScript ecosystem, this is interesting: Mocha is clearly the most popular test framework, while nodeunit is way behind. And no-one seems to use Jasmine. Jasmine appears to be unpopular within the JavaScript community but in reality that just accounts for those in the NodeJS and,
Read the rest
more recently, the subset of the front-end JS community who use NodeJS tools in their projects. Mocha, the most popular test framework, has been a Node module since late 2011 [0], whereas Jasmine has only been one since mid-2013 [1]. I have a hunch that the majority of Jasmine users aren't on-board with the movement of front-end JS and NodeJS ecosystems merging, and since Jasmine [3] doesn't really aim itself at NodeJS projects, it's far less likely to be used in any project which uses NPM for dependency management. Not really that important, just interesting :) [0]: https://github.com/visionmedia/mocha/commits/master/package.... [1]: https://github.com/pivotal/jasmine/commits/master/package.js... [2]: https://github.com/pivotal/jasmine
In NPM registry in numbers
author here: Pioneer uses cucumber and Pioneer for its tests, you are correct. We also have a suite of unit tests that are powered by mocha. Since we wanted true integration tests we choice to use Pioneer to test Pioneer. We wanted our feature files to act as documentation thus Cucumber was a clear choice. As far as precedence goes ... This is not an uncommon pattern Mocha uses mocha to test https://github.com/visionmedia/mocha/blob/master/test/http.m...
In Pioneer.js – JavaScript Integration Testing DSL
A couple suggestions: callback hell -- 1) Define your callback functions instead of passing anonymous functions everywhere. 2) Use a control flow library like async. https://npmjs.org/package/async This will greatly help in complex scenarios and the "waterfall" mode is particularly useful to accomplish something similar to chaining where values flow through multiple functions. Callback hell is not really an issue for most people after looking into these two things. data manipulation -- https://npmjs.org/package/lodash lodash is a fast functional utility library that makes it much easier to do the everyday data manipulation tasks. I pretty much assume this will be a dependency whenever I start a non-trivial project now. lack of standards -- Most people who really like node.js see this as a feature not a bug. This definitely drives away ma
Read the rest
ny people, but the intention is to promote as much choice as possible. Node.js people tend to be obsessed with choice and modularity. This is not meant as "you should think this way too" type explanation, but just a rough description of how the community is, good or bad. That being said, there are some standards out there. For example Felix's style guide is followed pretty well throughout the community (with a couple notable exceptions such as some of TJ Holowaychuk's stuff) http://nodeguide.com/style.html. mocha output -- It appears you have your reporter option set to "spec". This is a great reporter for visualizing a set of features, but for integration with something like Jenkins, I would recommend "tap" instead. It is also pretty trivial to write your own reporter, and then you can get whatever type of output you want. https://github.com/visionmedia/mocha/wiki/Third-party-report... mocha integration testing -- I agree that the example you showed was more of an integration test than a unit test. Mocha is not really doing anything to discourage unit testing though, and I would note that integration tests can be valuable. If it were me, I would tend to have my unit tests working against the actual module, instead of an endpoint, which is kind of sloppy. I hope that helps though :) I know it is often frustrating coming into a new language ecosystem, especially a "friendly-anarchy" oriented one like node.js.
In Node.js: Am I just doing it wrong?
We use a whole bunch, some of the main ones: - async => helpful async library https://github.com/caolan/async - nodeinspector => node js debugging in a nice webkit UI https://github.com/dannycoates/node-inspector - riakjs => for talking to Riak: http://riakjs.org/ - knox => S3 helper https://github.com/LearnBoost/knox - optimist => helper lib for writing command line node apps (no more bash :) https://github.com/substack/node-optimist - mocha => unit testing node code https://github.com/visionmedia/mocha - emailjs => email helper https://github.com/eleith/emailjs - uglifyjs => code minification https://github.com/mishoo/UglifyJS
In Show HN: clipboard.com, the best way to save anything online
Read the rest
In Our favorite node.js modules

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.