Unit testing async functions

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • jasmine

    Simple JavaScript testing framework for browsers and node.js

    Jasmine has been around a long time and remains one of my favorite test frameworks -- it's tiny, fast, and has no dependencies. It comes out of the box with async matchers, although you need to remember that asynchronous expectations in Jasmine must be made using the special expectAsync function instead of the usual expect function.

  • jest

    Delightful JavaScript Testing.

    Jest is the opposite of Jasmine, with its huge install footprint and slower runtime, but is immensely popular nowadays (especially for React testing). Like Jasmine, Jest comes with async matchers out of the box.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

  • mocha

    ☕️ simple, flexible, fun javascript test framework for node.js & the browser

    Mocha is a popular test framework that doesn't bundle its own assert/expect library, which makes it very flexible but also requires installing a few more packages to setup your test environment.

  • chai

    BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.

    For this example, I am using Mocha, plus Chai for its BDD expect syntax and the chai-as-promised plugin for asynchronous matchers.

  • chai-as-promised

    Extends Chai with assertions about promises.

    For this example, I am using Mocha, plus Chai for its BDD expect syntax and the chai-as-promised plugin for asynchronous matchers.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts