Skip to main content

Cypress Bundled Tools

Cypress relies on some of the best open-source testing libraries to make things more understandable and familiar. 

Many Javascript testers can quickly identify these bundled tools. This article can give fair knowledge of how bundled tools are used in Cypress.

1. Mocha

If you have already written a test in Cypress, you will always be used describe() it and before(). Well, that's because Cypress has adopted Mocha's BDD syntax, which goes well with integration and unit testing.

Any test that comes to your mind to be written on Cypress will sit on the fundamental harness mocha provides.

Using Mocha, Cypress has pretty solid async support as well.

Here are some of the familiar syntaxes:

  • describe()
  • context()
  • it()
  • before()
  • beforeEach()
  • afterEach()
  • after()
  • .only()
  • .skip()

2. Chai

Have you ever wondered how cypress assertions are straightforward to read and understand? Well, that's the work of Chai. It provides us the ability to write assertions quickly.

Chai gives out readable assertions with excellent backfire/error messages, and Cypress fixes several common pitfalls in Chai and wraps Chai's DSL using subjects and .should() command.

3. Chai-JQuery

While working with integration tests, there will be a lot of work in DOM. Cypress brings in Chai-jQuery, which extends Chai and provides jQuery specific chainer methods.

4. Sinon.JS

While writing the unit or integration test, we need to do stub and spy methods. Cypress included stub and spy to test unfinished APIs and implemented these from Sinon.

5. Sinon-Chai

When working with stubs and spies from Sinon in Cypress, we want to use assertions from Chai to couple them up and use it more often.

So cypress bundles with Sinon-Chai, which extends Chai to write assertions about stubs and spies.

Other Library Utilities

Cypress also bundles several other tools that can be used anywhere in your test. Those are:

  • Cypress._ (lodash)
  • Cypress.$ (jQuery)
  • Cypress.minimatch (minimatch.js)
  • Cypress.Blob (Blob utils)
  • Cypress.Buffer (Buffer utils)
  • Cypress.Promise (Bluebird)

Video Tutorial: Cypress Bundled Tools

Submitted by arilio666 on April 6, 2022

Ashwin is working with iVagus as a Technical Lead. He has experience in various technologies like Cypress, JavaScript, TypeScript, Rest Assured, Selenium, Cucumber, and Java.


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.