serverless-test-plugin
Advanced tools
Comparing version 0.2.0 to 0.2.1
19
index.js
@@ -185,4 +185,3 @@ 'use strict'; | ||
return functionData.run(stage, region, eventData) | ||
.then(function() { | ||
.then(function(result) { | ||
let duration = (Date.now() - startTime) / 1000; | ||
@@ -194,3 +193,11 @@ unhookIntercept(); // stop intercepting stdout | ||
if (duration > functionData.timeout) { | ||
if (!result || result.status !== "success") { | ||
let msg = result.error.toString(); | ||
testCase.addFailure(msg, "Failed"); | ||
SCli.log(chalk.bgRed.white(" ERROR ") + " " + | ||
chalk.red(msg)); | ||
failed++; | ||
} | ||
else if (duration > functionData.timeout) { | ||
let msg = `Timeout of ${functionData.timeout} seconds exceeded`; | ||
@@ -211,7 +218,9 @@ testCase.addFailure(msg, "Timeout"); | ||
unhookIntercept(); // stop intercepting stdout | ||
testCase.addFailure(err.toString(), "Failed"); | ||
let msg = err.toString(); | ||
testCase.addFailure(msg, "Failed"); | ||
// Done with errors. | ||
SCli.log(chalk.bgRed.white(" ERROR ") + " " + | ||
chalk.red(err.toString())); | ||
chalk.red(msg)); | ||
failed++; | ||
@@ -218,0 +227,0 @@ }); |
{ | ||
"name": "serverless-test-plugin", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=4.0" |
@@ -24,4 +24,6 @@ #Serverless Test Plugin | ||
###Configuration | ||
## Usage | ||
### Configuration | ||
This plugin can be configured on a function level by adding a `test` definition to the `custom` | ||
@@ -46,3 +48,3 @@ section in your `s-function.json`. | ||
###Usage | ||
### Run Tests | ||
@@ -94,1 +96,28 @@ Test an individual function: | ||
``` | ||
## Releases | ||
### 0.2.1 | ||
* Fixed an issue with the plugin not reporting error responses correctly. | ||
### 0.2.0 | ||
* Support for Serverless 0.5.0 and higher. | ||
### 0.1.5 | ||
* Fixed broken build. Sorry for that. | ||
### 0.1.4 | ||
* Set an environment variable `SERVERLESS_TEST` the invoked functions can check for | ||
### 0.1.3 | ||
* Cleanups | ||
### 0.1.2 | ||
* Cleanups | ||
### 0.1.1 | ||
* Capture `stdout` and `stderr` output of tests | ||
### 0.1.0 | ||
* Initial Release. |
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
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
13692
237
121