sls-jest
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-alpha.9 • Public • Published

sls-jest

Continuous Integration Release

sls-jest logo

A jest extension to test serverless applications.


Testing serverless applications is hard. Ideally, you want to test against the real infrastrucutre and avoid mocks. e.g. a real DynamoDB table, real Lambda functions. However, the asynchronous nature of serverless makes it difficult to write tests that work and are deterministic.

This library offers a suite of tools that help solve, or at least mitigate, those issues. It is built on top of the famous jest library and adds new serverless-related matchers.

Getting started

Install sls-jest

npm i sls-jest

Setup Jest

Create a setup file:

// setupJest.ts
import { matchers } from 'sls-jest';

expect.extend(matchers);

Then use it in your jest config file (jest.config.ts) under setupFilesAfterEnv:

export default {
  // ..
  setupFilesAfterEnv: ['./setupJest.ts'];
}

Documentation

For full documentation and guides, read the documentation website.

Readme

Keywords

none

Package Sidebar

Install

npm i sls-jest

Weekly Downloads

45

Version

1.0.0-alpha.9

License

ISC

Unpacked Size

132 kB

Total Files

92

Last publish

Collaborators

  • serverlessguru
  • bboure