
Security News
Node.js Moves Toward Stable TypeScript Support with Amaro 1.0
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
lambda-tester
Advanced tools
Simplifies writing unit tests for AWS Lambda functions using Node.js.
LAMBDA_TASK_ROOT
to the application's rootInstall via npm.
npm install lambda-tester --save-dev
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', function() {
return LambdaTester( myHandler )
.event( { name: 'Fred' } )
.expectResult();
});
});
If the handler decides to call callback( err )
then the verification will fail and 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', function() {
return LambdaTester( myHandler )
.event( { name: 'Unknown' } )
.expectError();
});
});
Please note that you must return the LambdaTester
back to the framework since lambda-tester
is asynchronous and uses Promises.
Complete documentation can be found in our documentation page.
lambda-tester
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 feedback@vandium.io
Version 3 targets Lambda handlers using Node 6.10 and 8.10. If you require support for Node 4.x, please use version 2.x
3.4.0 (2018-04-20)
Updated:
semver
. Thanks @AlexHankins @wheresrhysFixed:
package.json
engines to include node 8.x. Thanks @zanzamarFAQs
Unit/Integration tests for AWS Lambda handlers
The npm package lambda-tester receives a total of 31,371 weekly downloads. As such, lambda-tester popularity was classified as popular.
We found that lambda-tester demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.