testing-serverless-apps
testing-serverless-apps copied to clipboard
Code samples of how to make unit and e2e tests in serverless applications
Example of how to run e2e and unit tests on serverless apps using LocalStack and Jest
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
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 tor pressF5on VSCode.