🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

lambda-tester

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-tester - npm Package Compare versions

Comparing version

to
3.5.0

.nyc_output/422561e72fd92bd0c0ffc84770eb4264.json

17

CHANGELOG.md
# Change Log
## 3.5.0 (2018-07-23)
New:
* Support for async handlers that return promises.
Thanks @jkehres @jamesdixon @dtothefp @HajoAhoMantila
Updated:
* Version checking is a little less strict and supports node versions in the 8.x range.
Thanks @ArgamTorozyan
Internal:
* Updated dependencies
## 3.4.1 (2018-05-03)

@@ -4,0 +21,0 @@

2

docs/node-version-verification.md
# Node.js Version Verification
The default behavior of `lambda-tester` is to verify the version of the Node.js environment to ensure compatibility with the AWS Lambda
runtime. Node.js versions of `6.10` and higher up to `8.10` are allowed.
runtime. Node.js versions of `8.x` are allowed.

@@ -6,0 +6,0 @@ ## To disable version Verification

@@ -17,3 +17,3 @@ # lambda-tester

* Automatically loads .env files
* Works with Node 6.10 and 8.10
* Works with Node 8.x

@@ -26,2 +26,3 @@ ## Table of Contents

- [Verifying `callback()`](callback.md)
- [Verifying `Promise.resolve()` and `Promise.reject()`](promise.md)
- [Custom Event Values](events.md)

@@ -41,10 +42,8 @@ - [Resource Leak Detection](leak-detection.md)

## Compatibility
Version 3 targets Lambda handlers using Node 6.10 and 8.10. If you require support for Node 4.x, please use version 2
Starting with version 3.5.0, lambda-tester supports node versions 8.11 and higher. If you require support for older versions of node, then use a previous version of lambda-tester.
## License
[BSD-3-Clause](https://en.wikipedia.org/wiki/BSD_licenses)
'use strict';
const semver = require('semver')
const semver = require('semver');

@@ -13,3 +13,3 @@ const LambdaRunner = require( './runner' );

const SUPPORTED_NODE_RANGE = '6.10.1 - 8.10.0';
const SUPPORTED_NODE_RANGE = '8.10.0 - 8.999.0';

@@ -249,2 +249,31 @@ var checkForHandleLeak = false;

}
expectReject( resultVerifier ) {
let promise = resolveHandler( this )
.then( ( handler ) => {
return new LambdaRunner( 'Promise.reject', resultVerifier, this.options )
.withEvent( this._event )
.withContext( this._context, true )
.run( handler );
});
return addVerify( addCleanup( promise, this ) );
}
expectResolve( resultVerifier ) {
let promise = resolveHandler( this )
.then( ( handler ) => {
return new LambdaRunner( 'Promise.resolve', resultVerifier, this.options )
.withEvent( this._event )
.withContext( this._context, true )
.run( handler );
});
return addVerify( addCleanup( promise, this ) );
}
}

@@ -251,0 +280,0 @@

@@ -66,5 +66,7 @@ 'use strict';

case 'context.fail':
case 'Promise.reject':
return err;
case 'context.succeed':
case 'Promise.resolve':
return handlerResult.result;

@@ -244,3 +246,16 @@

handler( this.event, context, callback );
const ret = handler( this.event, context, callback );
if( ret && ret.then && typeof(ret.then) === 'function' ) {
ret
.then((result) => {
resolve( { method: 'Promise.resolve', err: null, result } )
},
(err) => {
resolve( { method: 'Promise.reject', err, result: null } )
});
}
}

@@ -247,0 +262,0 @@ catch( error ) {

{
"name": "lambda-tester",
"version": "3.4.1",
"version": "3.5.0",
"description": "Unit/Integration tests for AWS Lambda handlers",

@@ -23,3 +23,3 @@ "main": "lib/index.js",

"engines": {
"node": "^6.0.0 || ^8.0.0"
"node": ">=8.10.0"
},

@@ -46,8 +46,8 @@ "repository": {

"devDependencies": {
"aws-xray-sdk-core": "^1.1.1",
"aws-xray-sdk-core": "^1.3.0",
"bluebird": "^3.5.1",
"chai": "^4.1.2",
"freshy": "^1.0.2",
"mocha": "^5.0.0",
"nyc": "^11.4.1",
"mocha": "^5.2.0",
"nyc": "^11.9.0",
"proxyquire": "^1.8.0",

@@ -57,3 +57,3 @@ "sinon": "^4.0.0"

"dependencies": {
"app-root-path": "^2.0.1",
"app-root-path": "^2.1.0",
"dotenv": "^5.0.0",

@@ -63,5 +63,5 @@ "dotenv-json": "^1.0.0",

"semver": "^5.5.0",
"uuid": "^3.0.1",
"uuid": "^3.3.2",
"vandium-utils": "^1.1.1"
}
}

@@ -20,3 +20,3 @@ [![Build Status](https://travis-ci.org/vandium-io/lambda-tester.svg?branch=master)](https://travis-ci.org/vandium-io/lambda-tester)

* Automatically loads .env files
* Works with Node 6.10 and 8.10
* Works with Node 8.x

@@ -95,3 +95,3 @@ ## Installation

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
Starting with version 3.5.0, lambda-tester supports node versions 8.11 and higher. If you require support for older versions of node, then use a previous version of lambda-tester.

@@ -98,0 +98,0 @@