Alternatives to Mocha logo

Alternatives to Mocha

Jasmine, Jest, Chai, Cypress, and Protractor are the most popular alternatives and competitors to Mocha.
5.2K
2.7K
+ 1
430

What is Mocha and what are its top alternatives?

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.
Mocha is a tool in the Javascript Testing Framework category of a tech stack.
Mocha is an open source tool with GitHub stars and GitHub forks. Here’s a link to Mocha's open source repository on GitHub

Top Alternatives to Mocha

  • Jasmine
    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. ...

  • Jest
    Jest

    Jest provides you with multiple layers on top of Jasmine.

  • Chai
    Chai

    It is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework. It has several interfaces that allow the developer to choose the most comfortable. The chain-capable BDD styles provide an expressive language & readable style, while the TDD assert style provides a more classical feel. ...

  • Cypress
    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. ...

  • Protractor
    Protractor

    Protractor is an end-to-end test framework for Angular and AngularJS applications. Protractor runs tests against your application running in a real browser, interacting with it as a user would. ...

  • SinonJS
    SinonJS

    It is a really helpful library when you want to unit test your code. It supports spies, stubs, and mocks. The library has cross browser support and also can run on the server using Node.js. ...

  • SuperTest
    SuperTest

    It is a super-agent driven library for testing node.js HTTP servers using a fluent API. It provides a high-level abstraction for testing HTTP, while still allowing you to drop down to the lower-level API provided by superagent. ...

  • Enzyme
    Enzyme

    Enzyme is a JavaScript Testing utility for React that makes it easier to assert, manipulate, and traverse your React Components' output. ...

Mocha alternatives & related posts

Jasmine logo

Jasmine

3.3K
1.4K
186
DOM-less simple JavaScript testing framework
3.3K
1.4K
+ 1
186
PROS OF JASMINE
  • 64
    Can also be used for tdd
  • 49
    Open source
  • 18
    Originally from RSpec
  • 15
    Great community
  • 14
    No dependencies, not even DOM
  • 10
    Easy to setup
  • 8
    Simple
  • 3
    Created by Pivotal-Labs
  • 2
    Works with KarmaJs
  • 1
    Jasmine is faster than selenium in angular application
  • 1
    SpyOn to fake calls
  • 1
    Async and promises are easy calls with "done"
CONS OF JASMINE
  • 2
    Unfriendly error logs

related Jasmine posts

Joshua Dean Küpper
CEO at Scrayos UG (haftungsbeschränkt) · | 7 upvotes · 287.4K views

For our internal team and collaboration panel we use Nuxt.js (with TypeScript that is transpiled into ES6), Webpack and npm. We enjoy the opinionated nature of Nuxt.js over vanilla Vue.js, as we would end up using all of the components Nuxt.js incorporates anyways and we can adhere to the conventions setup by the Nuxt.js project, which allows us to get better support in case we run into any dead ends. Webpack allows us to create reproducable builds and also debug our application with hot reloads, which greately increased the pace at which we are able to perform and test changes. We also incorporated a lot of testing (ESLint, Chai, Jasmine, Nightwatchjs) into our pipelines and can trigger those jobs through GitLab CI. All packages are fetched through npm, so that we can keep our git repositories slim and are notified of new updates aswell as reported security flaws.

See more
Sai Chaitanya Mankala
Tech Lead at KIOT Innovations · | 6 upvotes · 225.8K views

Protractor or Cypress for ionic-angular?

We have a huge ionic-angular app with almost 100 pages and 10+ injectables. There are no tests written yet. Before we start, we need some suggestions about the framework. Would you suggest Cypress or Angular's Protractor with Jasmine / Karma for a heavy ionic app with Angular?

See more
Jest logo

Jest

7.8K
3.3K
175
Painless JavaScript Unit Testing
7.8K
3.3K
+ 1
175
PROS OF JEST
  • 36
    Open source
  • 32
    Mock by default makes testing much simpler
  • 23
    Testing React Native Apps
  • 20
    Parallel test running
  • 16
    Fast
  • 13
    Bundled with JSDOM to enable DOM testing
  • 8
    Mock by default screws up your classes, breaking tests
  • 7
    Out of the box code coverage
  • 7
    Promise support
  • 6
    One stop shop for unit testing
  • 3
    Great documentation
  • 2
    Assert Library Included
  • 1
    Built in watch option with interactive filtering menu
  • 1
    Preset support
  • 0
    Can be used for BDD
  • 0
    Karma
CONS OF JEST
  • 4
    Documentation
  • 4
    Ambiguous configuration
  • 3
    Difficult
  • 2
    Many bugs still not fixed months/years after reporting
  • 2
    Multiple error messages for same error
  • 2
    Difficult to run single test/describe/file
  • 2
    Ambiguous
  • 2
    Bugged
  • 1
    BeforeAll timing out makes all passing tests fail
  • 1
    Slow
  • 1
    Reporter is too general
  • 1
    Unstable
  • 1
    Bad docs
  • 1
    Still does't support .mjs files natively
  • 1
    Can't fail beforeAll to abort tests
  • 0
    Interaction with watch mode on terminal

related Jest posts

Robert Zuber

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
Shared insights
on
CypressCypressJestJest

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
Chai logo

Chai

2.1K
181
0
A BDD / TDD assertion library
2.1K
181
+ 1
0
PROS OF CHAI
    Be the first to leave a pro
    CONS OF CHAI
      Be the first to leave a con

      related Chai posts

      Joshua Dean Küpper
      CEO at Scrayos UG (haftungsbeschränkt) · | 7 upvotes · 287.4K views

      For our internal team and collaboration panel we use Nuxt.js (with TypeScript that is transpiled into ES6), Webpack and npm. We enjoy the opinionated nature of Nuxt.js over vanilla Vue.js, as we would end up using all of the components Nuxt.js incorporates anyways and we can adhere to the conventions setup by the Nuxt.js project, which allows us to get better support in case we run into any dead ends. Webpack allows us to create reproducable builds and also debug our application with hot reloads, which greately increased the pace at which we are able to perform and test changes. We also incorporated a lot of testing (ESLint, Chai, Jasmine, Nightwatchjs) into our pipelines and can trigger those jobs through GitLab CI. All packages are fetched through npm, so that we can keep our git repositories slim and are notified of new updates aswell as reported security flaws.

      See more

      React LoopBack Node.js ExpressJS Elasticsearch Kibana Logstash Sequelize Mocha Chai Visual Studio Code are the combo of technologies being used by me to build BestPrice Extension with all its micro-services & Web-based fragments

      See more
      Cypress logo

      Cypress

      2.4K
      1.9K
      115
      When testing is easy, developers build better things faster and with confidence.
      2.4K
      1.9K
      + 1
      115
      PROS OF CYPRESS
      • 29
        Open source
      • 22
        Great documentation
      • 20
        Simple usage
      • 18
        Fast
      • 10
        Cross Browser testing
      • 9
        Easy us with CI
      • 5
        Npm install cypress only
      • 1
        Não faz café
      • 1
        Good for beginner automation engineers
      • 0
        1
      CONS OF CYPRESS
      • 21
        Cypress is weak at cross-browser testing
      • 14
        Switch tabs : Cypress can'nt support
      • 12
        No iFrame support
      • 9
        No page object support
      • 9
        No multiple domain support
      • 8
        No file upload support
      • 8
        No support for multiple tab control
      • 8
        No xPath support
      • 7
        No support for Safari
      • 7
        Cypress doesn't support native app
      • 7
        Re-run failed tests retries not supported yet
      • 7
        No support for multiple browser control
      • 5
        $20/user/thread for reports
      • 4
        Adobe
      • 4
        Using a non-standard automation protocol
      • 4
        Not freeware
      • 3
        No 'WD wire protocol' support

      related Cypress posts

      Kamil Kowalski
      Lead Architect at Fresha · | 28 upvotes · 2M views

      When you think about test automation, it’s crucial to make it everyone’s responsibility (not just QA Engineers'). We started with Selenium and Java, but with our platform revolving around Ruby, Elixir and JavaScript, QA Engineers were left alone to automate tests. Cypress was the answer, as we could switch to JS and simply involve more people from day one. There's a downside too, as it meant testing on Chrome only, but that was "good enough" for us + if really needed we can always cover some specific cases in a different way.

      See more
      Robert Zuber

      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
      Protractor logo

      Protractor

      1.7K
      539
      33
      End-to-end test framework for Angular and AngularJS applications
      1.7K
      539
      + 1
      33
      PROS OF PROTRACTOR
      • 9
        Easy setup
      • 8
        Quick tests implementation
      • 6
        Flexible
      • 5
        Open source
      • 5
        Promise support
      CONS OF PROTRACTOR
      • 4
        Limited

      related Protractor posts

      Raziel Alron
      Automation Engineer at Tipalti · | 7 upvotes · 361.1K views

      Currently, we are using Protractor in our project. Since Protractor isn't updated anymore, we are looking for a new tool. The strongest suggestions are WebdriverIO or Puppeteer. Please help me figure out what tool would make the transition fastest and easiest. Please note that Protractor uses its own locator system, and we want the switch to be as simple as possible. Thank you!

      See more
      Sai Chaitanya Mankala
      Tech Lead at KIOT Innovations · | 6 upvotes · 225.8K views

      Protractor or Cypress for ionic-angular?

      We have a huge ionic-angular app with almost 100 pages and 10+ injectables. There are no tests written yet. Before we start, we need some suggestions about the framework. Would you suggest Cypress or Angular's Protractor with Jasmine / Karma for a heavy ionic app with Angular?

      See more
      SinonJS logo

      SinonJS

      1.4K
      346
      1
      Standalone test spies, stubs and mocks for JavaScript
      1.4K
      346
      + 1
      1
      PROS OF SINONJS
      • 1
        Open source
      CONS OF SINONJS
      • 1
        More concepts than Jest
      • 1
        Less questions and answers on StackOverflow than Jest

      related SinonJS posts

      SuperTest logo

      SuperTest

      1.1K
      36
      0
      A library for testing node.js HTTP servers
      1.1K
      36
      + 1
      0
      PROS OF SUPERTEST
        Be the first to leave a pro
        CONS OF SUPERTEST
          Be the first to leave a con

          related SuperTest posts

          Shared insights
          on
          SuperTestSuperTestPostmanPostman

          hello, I have started with Postman and SuperTest,, however I feel like both does a similar task, so please if anyone can advice me regarding what to choose for learning advanced content from both and what makes them different

          See more
          Enzyme logo

          Enzyme

          1K
          97
          0
          JavaScript Testing utilities for React, by Airbnb
          1K
          97
          + 1
          0
          PROS OF ENZYME
            Be the first to leave a pro
            CONS OF ENZYME
              Be the first to leave a con

              related Enzyme posts

              Russel Werner
              Lead Engineer at StackShare · | 7 upvotes · 168.8K views

              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

              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