Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cdk-lambda-nodejs-mock

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cdk-lambda-nodejs-mock

Mock out NodeJsFunction's processor-intensive calls to Parcel/Docker

  • 2.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Built with
typescript version dependants license

CDK NodejsFunction Mock

The CDK NodejsFunction construct uses Parcel and Docker to conveniently bundle up your lambda modules. However this is a slow and processor-intensive operation, which results in very slow testing with e.g. Jest.

This module mocks out NodeJsFunctions by replacing them with a standard CDK Lambda Function for the purpose of testing only.

Use with Jest

Whole Project

We recommend using this module across your entire CDK project, by editing your Jest config (e.g. in package.json) to add the following:

{
  "moduleNameMapper": {
    "@aws-cdk/aws-lambda-nodejs": "cdk-lambda-nodejs-mock"
  }
}

A Specific Test File Only

You can use in a specific test file only, rather than globally, as follows:

jest.mock('@aws-cdk/aws-lambda-nodejs', () =>
  require('cdk-lambda-nodejs-mock')
);

Note we use require rather than import, as jest.mock is hoisted above import.

CDK Versions

The module uses peerDependencies rather than dependencies, so that it uses exactly the same CDK version as in your project. This means that you don't need to do anything to make it work with whichever cdk version you are using.

Checklist

CD FeatureProvided
Typescript
Linting (AirBnB + Prettier)
Unit tests (Jest)
Coverage check (ideally 100% with Jest)
Github Continuous Deployment

Built by Skyhook

This module is contributed by the team at Skyhook

FAQs

Package last updated on 30 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc