Skip to content

Mocha

npm versionChat - DiscordOpenCollective sponsorsOpenCollective backers

Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing straightforward and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.

Get Started

Configuration Reference

Use Mocha at work? Ask your manager or marketing team if they’d help support our project. Your company’s logo will also be displayed on npmjs.com and our GitHub repository.

LocalizeBairesDev

Find Mocha helpful? Become a backer and support Mocha with a monthly donation.

HTTP ToolkitAutomatio AIWebdriverIOThird IronDamon OverboeDontPayFullAlessioLoc8NearMeZenRowsDan AprahamianMariusz NowakDamien MatherSoftware Development UKMobilemall.pkImmigration.sgTommi AaltonenVPSDimeLivingFeedsOwen BuckleyGame RulesGraphCommerceCrosslistScrapflyMatterGavin MoganVerslG7RSoftermiiKevin LampingSongsterr.comCrawlJobsformation.techRxDBFree TemplateQuarry Rentsbuzzvoice.comChudovoSister SitesReach DigitalTheme DiviVendSoftBestETFIT FlashcardsRebrowser.netRoundproxiesHypeProxiesRobey PointerSubscordSublynaRetailedPiloterrZINDCapturekitHuntAPIAllDevBlogsDiscount AgentNetwork ToolsTime.soOhMyFactsFeetpediaCalculatorsTime NowMillion.toolsSpin the WheelViewSnapStoriesTWT SProthotsJamdeskLove YouTiksterMeasurementUnitsStoryLookerMedyaMagazaNetroutingLocal Citation ServiceInstant FamousRetro GamesSuperClonesMod NodePro ConfigListCrawlerelfontario.caUAParser.jsRedReplyTik Ninja

In addition to chatting with us on our Discord, for additional information such as using spies, mocking, and shared behaviours be sure to check out the Mocha Wiki on GitHub. For a running example of Mocha, view example/tests.html.

For the old docs website, see: legacy.mochajs.org.

For the JavaScript API, view the API documentation or the source.