Giter Club home page Giter Club logo

testing-serverless-apps's Introduction

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.

testing-serverless-apps's People

Contributors

erickwendel avatar

Stargazers

André Gomes avatar  avatar Pedro Lugon avatar Valdoni avatar  avatar Leonardo Ferreira avatar Fernando Miguel avatar Gustavo Rizzon avatar Jonatas Felipe de Souza avatar Vinicius Santos avatar Alexandre Dias de Souza avatar Fellipe de Oliveira avatar Leonardo Gabriel Pivatto avatar Dhmeson avatar Artur Ferreira avatar Losangelo Soares de Sousa Pacífico avatar Guilherme Gomes avatar Gabriel Berthier avatar Sylvio Freire avatar Valdir S. Alves avatar Francisco Freire avatar  avatar Alan Miranda avatar Carlos Atílio Manuel avatar Vinicius Alberkovics avatar Felipe Rodrigues da Silva avatar Erik Lucas Maros avatar Luan Pereira Seixas avatar Matheus Lopes avatar Lucas De Freitas Roberto avatar Bruno Moura avatar Rodolpho Porto avatar José Lima avatar João Job avatar Renan de Souza Lima avatar Rickson Thompson avatar Kennedy Bacelar avatar Lucas A. Camacho avatar Arlan Marreiro avatar Fernando Teixeira avatar Lucas Torres  avatar Davi Santos avatar Rosiel Victor avatar Hytalo Coelho avatar Afonso Rafael avatar Dann Luciano avatar Eduardo Dias avatar Rafael Fideles avatar Gustavo Alexandre Nobre Mesquita avatar Diogo Souza avatar Mário César Silva avatar Alessandro Comparini avatar Luiz Alberto Adamchuk Jr avatar Mateus Garcia avatar Gustavo Souza avatar Johan Vilela avatar Marcelino Avelar avatar Bruno Puzoni avatar Isaque Lima avatar Rodrigo avatar Gladson avatar Felipe Souza avatar mareanalitica avatar Rodrigo Camilo avatar Evandro Ribeiro avatar João Vitor de Paiva avatar  avatar Diogo Ferreira avatar Rythelle C. Pereira avatar

Watchers

 avatar  avatar

testing-serverless-apps's Issues

CredentialsProviderError: Could not load credentials from any providers

Ao clonar o projeto e tentar executar conforme o vídeo postado no YouTube, me deparei com o seguinte erro: CredentialsProviderError: Could not load credentials from any providers. Com isso, adicionei o seguinte código no arquivo factory, e funcionou normalmente.

Codigo:

if (isLocal) {
	const host = process.env.LOCALSTACK_HOST || "localhost";
	s3config.endpoint = `http://${host}:4566`;
+	s3config.credentials = {
+		accessKeyId: "test",
+		secretAccessKey: "test",
+	};
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.