serverless-test-plugin
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -102,2 +102,5 @@ 'use strict'; | ||
// Set an environment variable the invoked functions can check for | ||
process.env.SERVERLESS_TEST = true; | ||
// Prepare result object | ||
@@ -256,3 +259,5 @@ evt.data.result = { status: false }; | ||
return resolve(); | ||
}); | ||
}).finally() { | ||
process.env.SERVERLESS_TEST = undefined; | ||
}; | ||
}); | ||
@@ -259,0 +264,0 @@ } |
{ | ||
"name": "serverless-test-plugin", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=4.0" |
#Serverless Test Plugin | ||
[![npm version](https://badge.fury.io/js/serverless-test-plugin.svg)](https://badge.fury.io/js/serverless-test-plugin) | ||
Simple _Integration Test Framework_ for [Serverless](http://www.serverless.com). This plugin is basically a | ||
@@ -8,5 +10,5 @@ reimplementation of the `run` command, validating a function's _success_. You can test all | ||
This plugin is intended to run _besides_ your regular Unit Tests such as [Mocha](https://mochajs.org/). | ||
This plugin is intended to run _besides_ your regular Unit Tests such as [Mocha](https://mochajs.org/), not as a replacement. It will solely validate that your functions have no compilation errors and can successfully run the provided `event.json`. At this point there's no output validation other than checking for success, failure or a timeout (that is, if your Lambda code exceeds the specified timeout value). | ||
**Note:** Serverless *v0.1.4* or higher is required. | ||
Typically you want to run this plugin right before deploying your Lambda code. | ||
@@ -20,3 +22,5 @@ | ||
**Note:** Serverless *v0.1.4* or higher is required. | ||
###Configuration | ||
@@ -40,3 +44,3 @@ | ||
* `skip` - boolean; skip this function from all tests | ||
* `event` - string; name of the event JSON definition; defaults to `event.js` | ||
* `event` - string; name of the event JSON definition; defaults to `event.json` | ||
@@ -66,1 +70,9 @@ | ||
To detect whether your code runs in a test environment or not, check for the `SERVERLESS_TEST` environment variable: | ||
``` | ||
if (process.env.SERVERLESS_TEST) { | ||
console.log("This code runs as part of an intergration test."); | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12372
223
75
8