Using uvu for TypeScript API Testing

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
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • uvu

    uvu is an extremely fast and lightweight test runner for Node.js and the browser

  • In this post we will look at using uvu for TypeScript API testing. uvu is a lightweight and lightning fast test runner. It is bare-boned though has enough functionality to run unit and integration tests on your app's backend. Being so fast you can merge it into your continuous integration process. This means you can run tests before every push to your git repo. On top it works well with test driven development, where you write tests first to define expected behaviour and then implement your feature.

  • uvu-fastify-graphql

    Using uvu for TypeScript API testing: we take a look at integrating a fast test runner into your backend continuous integration workflow.

  • We won't build an app as we normally do in these posts. I have created a basic GraphQL API coded in TypeScript and using Fastify and Apollo server though. So you can clone that from the git repo to follow along or check out details we don't have time to go into here. Although that code uses Fastify, you can use uvu with Express or other node-based servers. You can also use it with JavaScript (not just TypeScript).

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

    SurveyJS logo
  • supertest

    🕷 Super-agent driven library for testing node.js HTTP servers using a fluent API. Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.

  • SuperTest is helpful for testing the GraphQL endpoints. We can use it to send HTTP requests and make assertions on the responses. If you are working on a Fastify project, as we will see, you use inbuilt Fastify functionality and don't need to add supertest.

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