这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ Your Lambda function should have a package.json which you can modify to add a te
"test": "run-local-lambda --file index.js --event tests/event.json --timeout 3"
}
```
To add some environment variables to your test script, you can add --processenv so:

```js
"scripts": {
"test": "run-local-lambda --file index.js --event tests/event.json -- processenv tests/envir.json --timeout 3"
}
```

Finally, you can invoke your test by simply running:

Expand Down Expand Up @@ -50,6 +57,7 @@ This module accepts the following parameters which are all optional.
* --event [event file name] - Event data file name. Default: event.json
* --handler [handler name] - Lambda function handler. Default: handler
* --timeout [timeout seconds] - The timeout in seconds. Default: 3
* --processenv [environment file name] - Environment data file name. Default: blank (optional)

### Context
The context object provides the following public methods:
Expand Down Expand Up @@ -104,6 +112,14 @@ The event data file can be provided using the --event parameter. An event is jus
]
}
```
### Environment
The environment data file can be provided using the --processenv parameter. An event is just a JSON object such as:

```js
{
"BUCKET":"<BUCKET-NAME>"
}
```

See this [AWS documentation](http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-upload-deployment-pkg.html) for more information on testing Lambda functions manually.

Expand Down