All Projects → vandium-io → Lambda Tester

vandium-io / Lambda Tester

Licence: bsd-3-clause
Helper for unit testing AWS Lambda functions

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Lambda Tester

Bentoml
Model Serving Made Easy
Stars: ✭ 3,064 (+1215.02%)
Mutual labels:  aws-lambda
Hal
hal provides an AWS Lambda Custom Runtime environment for your Haskell applications.
Stars: ✭ 213 (-8.58%)
Mutual labels:  aws-lambda
Aws Lambda Cheatsheet
AWS Lambda cheatsheet.
Stars: ✭ 227 (-2.58%)
Mutual labels:  aws-lambda
Alexa Youtube Skill
Allows Alexa to play audio from YouTube videos
Stars: ✭ 200 (-14.16%)
Mutual labels:  aws-lambda
Yoyo
A dead simple comment engine built on top of AWS lambda and React, alternative comment service to Disqus.
Stars: ✭ 210 (-9.87%)
Mutual labels:  aws-lambda
Apilogs
Easy logging and debugging for Amazon API Gateway and AWS Lambda Serverless APIs
Stars: ✭ 216 (-7.3%)
Mutual labels:  aws-lambda
Lambda Decorators
🐍λ✨ - A collection of useful decorators for making AWS Lambda handlers
Stars: ✭ 197 (-15.45%)
Mutual labels:  aws-lambda
Aws Lambda Typescript
This sample uses the Serverless Application Framework to implement an AWS Lambda function in TypeScript, deploy it via CloudFormation, publish it through API Gateway to a custom domain registered on Route53, and document it with Swagger.
Stars: ✭ 228 (-2.15%)
Mutual labels:  aws-lambda
Chrome Aws Lambda Layer
43 MB Google Chrome to fit inside AWS Lambda Layer compressed with Brotli
Stars: ✭ 212 (-9.01%)
Mutual labels:  aws-lambda
Aws Lambda Haskell Runtime
⚡Haskell runtime for AWS Lambda
Stars: ✭ 223 (-4.29%)
Mutual labels:  aws-lambda
Dialetus Service
API to Informal dictionary for the idiomatic expressions that each Brazilian region It has
Stars: ✭ 202 (-13.3%)
Mutual labels:  aws-lambda
Retinal
🏙 Retinal is a Serverless AWS Lambda service for resizing images on-demand or event-triggered
Stars: ✭ 208 (-10.73%)
Mutual labels:  aws-lambda
Pychromeless
Python Lambda Chrome Automation (naming pending)
Stars: ✭ 219 (-6.01%)
Mutual labels:  aws-lambda
Rust Crowbar
Wrapper to simplify writing AWS Lambda functions in Rust (using the Python execution environment)
Stars: ✭ 198 (-15.02%)
Mutual labels:  aws-lambda
Serverless Chrome
🌐 Run headless Chrome/Chromium on AWS Lambda
Stars: ✭ 2,625 (+1026.61%)
Mutual labels:  aws-lambda
Aws Lambda Power Tuning
AWS Lambda Power Tuning is an open-source tool that can help you visualize and fine-tune the memory/power configuration of Lambda functions. It runs in your own AWS account - powered by AWS Step Functions - and it supports three optimization strategies: cost, speed, and balanced.
Stars: ✭ 3,040 (+1204.72%)
Mutual labels:  aws-lambda
Bitwarden Serverless
Implementation of the Bitwarden API using an AWS serverless stack
Stars: ✭ 217 (-6.87%)
Mutual labels:  aws-lambda
Formplug Serverless
Form forwarding service for AWS Lambda
Stars: ✭ 232 (-0.43%)
Mutual labels:  aws-lambda
Algnhsa
AWS Lambda Go net/http server adapter
Stars: ✭ 226 (-3%)
Mutual labels:  aws-lambda
Ffmpeg Aws Lambda Layer
FFmpeg/FFprobe AWS Lambda layer
Stars: ✭ 222 (-4.72%)
Mutual labels:  aws-lambda

Build Status npm version

lambda-tester

Simplifies writing unit tests for AWS Lambda functions using Node.js.

Features

  • Verifies correct handler behavior
  • Mocks event types with code
  • Works asynchronously
  • Supports Promises
  • Verifies Node.js runtime version
  • AWS X-Ray support [experimental]
  • Detects resource leaks [experimental]
  • Easily integrates with test frameworks (Mocha and Jasmine)
  • Handlers can be loaded and removed after execution
  • Lightweight and won't impact performance
  • Maps the environment variable LAMBDA_TASK_ROOT to the application's root
  • Automatically loads .env files
  • Works with Node 10.x, and 12.x

Installation

Install via npm.

npm install lambda-tester --save-dev

Getting Started

Lambda handlers with support for callbacks use the typical Node.js asynchronous signature:

exports.handler = function( event, context, callback ) {

    callback( null, 'success!' );
}

The following example shows a simple case for validating that the Lambda (handler) was called successfully (i.e. callback( null, result ):

const LambdaTester = require( 'lambda-tester' );

const myHandler = require( '../index' ).handler;

describe( 'handler', function() {

	it( 'test success', async function() {

		await LambdaTester( myHandler )
			.event( { name: 'Fred' } )
			.expectResult();
	});
});

If the handler calls callback( err ), then the test will fail.

Additionally, if one wanted to test for failure, then the following code would be used:

const LambdaTester = require( 'lambda-tester' );

const myHandler = require( '../index' ).handler;

describe( 'handler', function() {

	it( 'test failure', async function() {

		await LambdaTester( myHandler )
			.event( { name: 'Unknown' } )
			.expectError();
	});
});

Note: you must either return the LambdaTester instance back to the testing framework or use the await/async keywords.

Documentation

Complete documentation can be found in our documentation page.

Projects Using lambda-tester

  • vandium - Secures and simplifies AWS Lambda handlers

Feedback

We'd love to get feedback on how you're using lambda-tester and things we could add to make this tool better. Feel free to contact us at [email protected]

Compatibility

Starting with version 4.0, lambda-tester supports node versions 10 and higher. If you require support for older versions of node, then use a previous version of lambda-tester.

License

BSD-3-Clause

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].