# aws-lambda-mock-context

> AWS Lambda mock context object

Latest version **3.2.1** (published 2018-08-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install aws-lambda-mock-context
pnpm add aws-lambda-mock-context
yarn add aws-lambda-mock-context
bun add aws-lambda-mock-context
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.1 |
| Published | 2018-08-04 |
| First published | 2015-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 3 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Sam Verschueren |
| Maintainers | samverschueren |
| Keywords | aws, lambda, context, ctx, function, mocking, mock, promise |

## Links

- npm: https://www.npmjs.com/package/aws-lambda-mock-context
- npm.io page: https://npm.io/package/aws-lambda-mock-context

## Dependencies (3)

- [uuid](https://npm.io/package/uuid.md) ^3.0.1
- [moment](https://npm.io/package/moment.md) ^2.10.5
- [pinkie-defer](https://npm.io/package/pinkie-defer.md) ^1.0.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 3.2.1 (latest) — 2018-08-04
- 3.2.0 — 2018-07-11
- 3.1.1 — 2017-06-05
- 3.1.0 — 2017-05-17
- 3.0.1 — 2016-10-14
- 3.0.0 — 2016-05-20
- 2.0.0 — 2016-03-21
- 1.1.0 — 2015-12-16
- 1.0.0 — 2015-11-06
- 0.2.0 — 2015-08-13
- 0.1.1 — 2015-07-27
- 0.1.0 — 2015-07-27

## README

# aws-lambda-mock-context [![Build Status](https://travis-ci.org/SamVerschueren/aws-lambda-mock-context.svg?branch=master)](https://travis-ci.org/SamVerschueren/aws-lambda-mock-context)

> AWS Lambda mock context object


## Installation

```
$ npm install --save-dev aws-lambda-mock-context
```


## Usage

```js
const context = require('aws-lambda-mock-context');

const ctx = context();

index.handler({hello: 'world'}, ctx);

ctx.Promise
    .then(() => {
        //=> succeed() called
    })
    .catch(err => {
        //=> fail() called
    });
```


## API

### context(options)

#### options

##### region

Type: `string`<br>
Default: `us-west-1`

AWS region.

##### account

Type: `string`<br>
Default: `123456789012`

Account number.

##### functionName

Type: `string`<br>
Default: `aws-lambda-mock-context`

Name of the function.

##### functionVersion

Type: `string`<br>
Default: `$LATEST`

Version of the function.

##### memoryLimitInMB

Type: `string`<br>
Default: `128`

Memory limit.

##### alias

Type: `string`

Alias of the function.

##### timeout

Type: `number`<br>
Default: `3`

Timeout of the lambda function in seconds.


## Related

- [aws-lambda-pify](https://github.com/SamVerschueren/aws-lambda-pify) - Promisify an AWS lambda function.


## License

MIT © [Sam Verschueren](https://github.com/SamVerschueren)

---
_Source: https://npm.io/package/aws-lambda-mock-context · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
