Cypressย vsย Jestย vsย Mocha

Get Advice Icon

Need advice about which tool to choose?Ask the StackShare community!

Cypress
Cypress

409
308
+ 1
30
Jest
Jest

1.8K
1.2K
+ 1
127
Mocha
Mocha

2.6K
1.8K
+ 1
402

What is Cypress?

Cypress is a front end automated testing application created for the modern web. Cypress is built on a new architecture and runs in the same run-loop as the application being tested. As a result Cypress provides better, faster, and more reliable testing for anything that runs in a browser. Cypress works on any front-end framework or website.

What is Jest?

Jest provides you with multiple layers on top of Jasmine.

What is Mocha?

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

Need advice about which tool to choose?Ask the StackShare community!

Why do developers choose Cypress?
Why do developers choose Jest?
Why do developers choose Mocha?

Sign up to add, upvote and see more prosMake informed product decisions

Sign up to add, upvote and see more consMake informed product decisions

What companies use Cypress?
What companies use Jest?
What companies use Mocha?

Sign up to get full access to all the companiesMake informed product decisions

What tools integrate with Cypress?
What tools integrate with Jest?
What tools integrate with Mocha?
    No integrations found

    Sign up to get full access to all the tool integrationsMake informed product decisions

    What are some alternatives to Cypress, Jest, and Mocha?
    Selenium
    Selenium automates browsers. That's it! What you do with that power is entirely up to you. Primarily, it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web-based administration tasks can (and should!) also be automated as well.
    TestCafe
    It is a pure node.js end-to-end solution for testing web apps. It takes care of all the stages: starting browsers, running tests, gathering test results and generating reports.
    Puppeteer
    Puppeteer is a Node library which provides a high-level API to control headless Chrome over the DevTools Protocol. It can also be configured to use full (non-headless) Chrome.
    WebdriverIO
    WebdriverIO lets you control a browser or a mobile application with just a few lines of code. Your test code will look simple, concise and easy to read.
    Jasmine
    Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on browsers, DOM, or any JavaScript framework. Thus it's suited for websites, Node.js projects, or anywhere that JavaScript can run.
    See all alternatives
    Decisions about Cypress, Jest, and Mocha
    Dschinkel Schinkel
    Dschinkel Schinkel
    Mocha
    Mocha
    Jest
    Jest
    JavaScript
    JavaScript
    React
    React
    Enzyme
    Enzyme
    #Tdd
    #Bdd
    #Testdrivendevelopment

    I use both mocha and Jest because:

    • I don't care whether teams use Jest or Mocha. But jest is way too overhyped. Most devs are writing integration tests and think that it's so much better but frankly I don't write integration tests as the way to get both design feedback and confidence when I code. I adhere to the test pyramid, not ice cream cone or the dumb "trophy"

    • I TDD, so I only ever use the "API" of test frameworks. I don't do a lot of integration tests for TDD and all the bells and whistles Jest provides you from the command-line I just don't need. And I certainly do not care about or touch Jest Snapshots, I despise them

    • My tests are fast enough because I write isolated tests with TDD, so I don't run into performance issues. Example: I write my tests in a way that I can run 300 tests in literally 1 second with mocha. So the Jest ability to pinpoint and only run those tests which are affected by code changes. I want to run all of them every time when I TDD. It's a different mindset when you TDD

    • I also mainly code in IntelliJ or WebStorm because I feel the tools in that IDE far surpass VSCode and I also love running the test UI runner in it vs. lousy command-line

    • I feel both mocha and Jest read just fine in terms of code readability. Jest might have shorter assertion syntax but I don't really care. I just care that I can read the damn test and my tests are written well and my test descriptions, as well as the code itself including constants represent business language, not technical. I care most about BDD, clean code, 4 rules of simple design, and SOLID

    • I don't like using mock frameworks so no I don't use Jest's Mocking framework. I don't have to mock a lot in my tests due to the nature of how I strive to code...I keep my design simple and modular using principals such as clean code and 4 rules of simple design. If I must mock, I create very simple custom mocks with JS

    • On the contrary to the belief that integration tests and mount are the way to go (this belief drives me absolutely crazy, especially Dodd's promoting that), I TDD with shallow & enzyme. My tests are simple. My design is driven by my tests and my tests give me quick and useful feedback. I have a course I'm working on coming out soon on TDD with React to show you how to truly test the FE and why the ice cream cone and trophy suck (you're being scammed people). Watch for that here: https://twitter.com/DaveSchinkel/status/1062267649235791873

    Don't forget to upvote this post!

    Mocha Jest JavaScript React @jsdom Enzyme #tdd #bdd #testdrivendevelopment

    See more
    Russel Werner
    Russel Werner
    Lead Engineer at StackShare ยท | 6 upvotes ยท 89.8K views
    atStackShareStackShare
    Jest
    Jest
    Enzyme
    Enzyme
    React Storybook
    React Storybook
    Happo.io
    Happo.io
    Percy
    Percy

    We use Jest because when we rebooted our "front end" stack earlier last year, we need to have a testing solution (we didn't have any front-end tests before that!). Jest is fast and convenient and it has plenty of community support behind it. It let's us run our unit tests with Enzyme and snapshot tests.

    This is an area that we are constantly reviewing to see what can be improved, both in terms of developer needs, accuracy, test maintainability, and coverage.

    I'm currently exploring using React Storybook to be the record of snapshot tests and using some online services, such as Happo.io and Percy in our CI pipeline.

    See more
    Scott Mebberson
    Scott Mebberson
    CTO / Chief Architect at Idearium ยท | 2 upvotes ยท 34.8K views
    Mocha
    Mocha
    Jest
    Jest

    We used to Mocha for as our primary Node.js test framework. We've now switched to Jest and haven't looked back.

    Jest is faster and requires less setup and configuration. The Mocha API and eco-system is vast and verified, but that also brings complexity.

    It you want to get in, write tests, execute them and get out, try Jest ๐Ÿ˜€

    See more
    Gustavo Muรฑoz
    Gustavo Muรฑoz
    Web UI Developer at Globant ยท | 1 upvotes ยท 2.8K views
    Jest
    Jest
    Enzyme
    Enzyme

    I really enjoy using Jest as my testing framework. I also use Enzyme to complement, and both together are amazing. Jest is fast and easy to use, It has all you need together under the same tool, and it's pretty easy to create all kind of test, even asynchronous ones. I was responsible for implant it in our company projects, and it was the best decision for testing.

    See more
    Jack Graves
    Jack Graves
    Head of Product Development at Automation Consultants ยท | 3 upvotes ยท 55.8K views
    atAutomation ConsultantsAutomation Consultants
    JUnit
    JUnit
    Jest
    Jest
    Apache JMeter
    Apache JMeter
    Mocha
    Mocha

    We use JUnit and Jest to perform the bulk of our automated test scenarios, with additional work with Apache JMeter for performance testing - for example, the Atlassian Data Center compliance testing is performed with JMeter. Jest provides testing for the React interfaces, which make up the backend of our App offerings. JUnit is used for Unit Testing our Server-based Apps. Mocha is another tool we use.

    See more
    Robert Zuber
    Robert Zuber
    CTO at CircleCI ยท | 16 upvotes ยท 438.7K views
    atCircleCICircleCI
    Next.js
    Next.js
    React
    React
    Storybook
    Storybook
    TypeScript
    TypeScript
    Emotion
    Emotion
    GraphQL
    GraphQL
    Apollo
    Apollo
    Jest
    Jest
    Percy
    Percy
    Cypress
    Cypress

    We are in the process of adopting Next.js as our React framework and using Storybook to help build our React components in isolation. This new part of our frontend is written in TypeScript, and we use Emotion for CSS/styling. For delivering data, we use GraphQL and Apollo. Jest, Percy, and Cypress are used for testing.

    See more
    Jorge Quiros
    Jorge Quiros
    SR QA Automation Engineer at Indecomm ยท | 9 upvotes ยท 358.8K views
    Protractor
    Protractor
    Jasmine
    Jasmine
    JavaScript
    JavaScript
    Selenium
    Selenium
    Cypress
    Cypress
    #Testing
    #Cypress
    #Qaautomation

    This is a trending topic on Automation testing for E2E web applications.

    I have used Protractor and Jasmine for automation testing frameworks in JavaScript by using the Selenium web driver manager.

    Now, new guy in town Cypress does not use Selenium and runs directly in your app without any json wire protrocol, but it does not support parallel testing or mobile testing.

    Have you experienced both? Should I stick with old and known ?

    #testing cypress #selenium qaautomation #qa

    See more
    Jest
    Jest
    Cypress
    Cypress

    As we all know testing is an important part of any application. To assist with our testing we are going to use both Cypress and Jest. We feel these tools complement each other and will help us get good coverage of our code. We will use Cypress for our end to end testing as we've found it quite user friendly. Jest will be used for our unit tests because we've seen how many larger companies use it with great success.

    See more
    Interest over time
    Reviews of Cypress, Jest, and Mocha
    Avatar of cristiangiagante
    .Net Developer at Hexacta
    Review ofJestJest

    I'm using Jest for 3 months in a Vue JS project . I need to use a lot of custom search of related topics in jest docs because it's not clear. The examples are very poor too.

    How developers use Cypress, Jest, and Mocha
    Avatar of Volkan ร–zรงelik
    Volkan ร–zรงelik uses JestJest

    Jest is my unit-testing tool of choice.

    Almost all unit testing suites (Mocha, Jasmine, etc.) are more or less the same.

    The main advantage I guess, is that it integrates pretty well with React and Enzyme.

    Avatar of Matt Welke
    Matt Welke uses MochaMocha

    Used for unit testing when working with Node.js. Used over other testing frameworks because of good compatibility with TypeScript and ts-node.

    Avatar of Kang Hyeon Ku
    Kang Hyeon Ku uses MochaMocha

    javascript ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•ด ์จ๋ณธ ํ”„๋ ˆ์ž„์›Œํฌ ์ด๋‹ค. ์ดˆ๋ฐ˜ ์œ ๋ช…ํ•œ ํ”„๋ ˆ์ž„์›Œํฌ์ค‘ ํ•˜๋‚˜์˜€๋Š”๋ฐ ์š”์ฆ˜์€ ๋„ˆ๋ฌด ํ…Œ์ŠคํŠธ ํ”„๋ ˆ์ž„์›Œํฌ๋„ ๋‹ค์–‘ํ•ด์ ธ ์ž˜ ๋ชจ๋ฅด๊ฒ ๋‹ค. junit ์—๊ฒŒ๋Š” hamcrest ์ด ์žˆ๋‹ค๋ฉด mocha ์—๊ฒŒ๋Š” chai๊ฐ€ ์žˆ๋‹ค.

    Avatar of Dave Woolfenden
    Dave Woolfenden uses MochaMocha

    Is a feature-rich JavaScript test framework running on Node.js and in the browser supporting asynchronous testing.

    Avatar of Cypress.io
    Cypress.io uses CypressCypress

    Test frontend behavior, requests to API endpoints, and assertions on JSON schemas for fixtures

    Avatar of Kingsley Victor
    Kingsley Victor uses MochaMocha

    Mocha is ideal for running tests on apis built with Node's Express

    Avatar of Tim De Lange
    Tim De Lange uses MochaMocha

    Unit testing on shared code between brow ser and back end.

    How much does Cypress cost?
    How much does Jest cost?
    How much does Mocha cost?
    Pricing unavailable
    Pricing unavailable
    Pricing unavailable
    News about Cypress
    More news