Skip to content

ErickWendel/testing-serverless-apps

Repository files navigation

Example of how to run e2e and unit tests on serverless apps using LocalStack and Jest

Build Status

Code samples of my video on testing serverless applications.

It uses Jest as test runner, LocalStack as a mock server for AWS Services, serverless framework to deploy apps on AWS and GitHub Actions as continuous integration platform.

Note that it uses ECMAScript Modules empowered by Node.js v20 without any bundlers (NICE).

Leave your star 🌟 in the project 💚

  • In the ./tests folder I put two examples: e2e and unit tests folder and there you can take a look on how to make those tests.
  • In ./src/factory.js you can take a look on how to configure the AWS SDK v3 to point it to localStack when in development mode.

Running

Testando aplicacnes serverless

Pre reqs

  • Install Docker & Docker-compose
  • Install Node.js v20

Running

  • run docker-compose up -d localstack
  • restore node.js dependencies npm ci
  • run tests npm t or press F5 on VSCode.