Giter Club home page Giter Club logo

serverless-jest-plugin's Introduction

Serverless Jest Plugin

Build Status

A Serverless Plugin for the Serverless Framework which adds support for test-driven development using jest

THIS PLUGIN REQUIRES SERVERLESS V1.0 OR LATER!

More familiar with Mocha? Try serverless-mocha-plugin.

Introduction

This plugins does the following:

  • It provides commands to create and run tests manually
  • It provides a command to create a function, which automatically also creates a test

Installation

In your service root, run:

npm install --save-dev serverless-jest-plugin

Add the plugin to serverless.yml:

plugins:
  - serverless-jest-plugin
custom:
  jest:
    # You can pass jest options here
    # See details here: https://facebook.github.io/jest/docs/configuration.html
    # For instance, uncomment next line to enable code coverage
    # collectCoverage: true

Usage

Creating functions

Functions (and associated tests) can be created using the command

sls create function -f functionName --handler handler

e.g.

sls create function -f myFunction --handler functions/myFunction/index.handler

creates a new function myFunction into serverless.yml with a code template for the handler in functions/myFunction/index.js and a Javascript function module.exports.handler as the entrypoint for the Lambda function. A test template is also created into test/myFunction.js. Optionally tests can be created to specific folder using --path or -p switch, e.g.

sls create function -f myFunction --handler functions/myFunction/index.handler --path tests

To create tests next to handler use --path {function}, in following example test file myFunction.test.js is created to functions/myFunction/ directory.

sls create function -f myFunction --handler functions/myFunction/index.handler --path {function}

Creating tests

Tests can also be added to existing handlers using

sls create test -f functionName

Running tests

Tests can be run directly using Jest or using the "invoke test" command

sls invoke test [--stage stage] [--region region] [-f function]

If no function names are passed to "invoke test", all tests related to handler functions are run.

License

https://github.com/nordcloud/serverless-jest-plugin/blob/master/LICENSE

serverless-jest-plugin's People

Contributors

aardvarkk avatar artoliukkonen avatar ckknight avatar electblake avatar jasonmccallister avatar karihe avatar laardee avatar magic-madrigal avatar polem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serverless-jest-plugin's Issues

Running `sls invoke test` results in: `the "path" argument must be of type string`

I am currently using "serverless-jest-plugin": "^0.1.6" and "jest": "^22.2.2".

This is my config in serverless.yml:

custom:
  jest:
     roots:
      - '<rootDir>/tests'   

Running either sls invoke test or sls invoke test --path tests it outputs:

 FAIL  tests/customMessage.test.js
  ● Test suite failed to run

    TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
      
      at assertPath (path.js:28:11)
      at Object.relative (path.js:1259:5)

 FAIL  tests/postConfirmation.test.js
  ● Test suite failed to run

    TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
      
      at assertPath (path.js:28:11)
      at Object.relative (path.js:1259:5)

Test Suites: 2 failed, 2 total
Tests:       0 total
Snapshots:   0 total
Time:        0.483s
Ran all test suites.

how to define jest configuration in custom file

Here is my serverless file which I define the plugin and variable in a custom file

custom: ${file(${opt:stage, self:provider.stage}.yml)}

plugins: ${self:custom.plugins, ''}

my environment file:

$ cat dev.yml
plugins:
  - serverless-jest-plugin
jest:
  collectCoverage: true

Here is the error I got.

$ sls create test -f auth

  Serverless Error ---------------------------------------

  Serverless command "create test" not found

  Run "serverless help" for a list of all available commands.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless

  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           6.11.3
     Serverless Version:     1.24.1

The other variables in custom environment file works fine, which I used to define stage, service name, etc.

If I follow the README to define jest plugin and configuration directly in serverless.yml, it works.

Feature: support for multiple file extensions

Hello,
I'd like to use serverless-jest-plugin with ts-jest, I have functional serverless.yml configuration but it would also requires minimal changes in lib/run-tests.js.

custom:
  jest:
    transform:
      "^.+\\.(t|j)sx?$": "ts-jest"
    preset: ts-jest
    moduleFileExtensions:
      - ts
      - js
      - json
      - node

https://github.com/SC5/serverless-jest-plugin/blob/master/lib/run-tests.js#L20 to

Object.assign(config, { testRegex: `${functionName}\\.test\\.(j|t)s$` });

https://github.com/SC5/serverless-jest-plugin/blob/master/lib/run-tests.js#L25 to

const functionsRegex = allFunctions.map(name => `${name}\\.test\\.(j|t)s$`).join('|');

Is it ok to submit such PR?

Reference Variables in Javascript Files, Cannot find module

Hello,

First off, thank you very much for this plugin. Makes TS serverless development with Jest very much easier. I may have an interesting corner case to bring up, though hopefully this is something simple I am doing wrong.

This all started with trying to hook a programmatic infrastructure update into the CloudFormation stack update on serverless deploy using a CFN custom resource. Worked great for the initial custom resource creation, but I wanted the update to run on subsequent deploys as well. Which lead me here:

serverless/serverless#4483

Following the excellent suggestion here:

serverless/serverless#4483 (comment)

Using serverless file variables:

https://www.serverless.com/framework/docs/providers/aws/guide/variables#reference-variables-in-javascript-files

I was able to get the updates running on every serverless deploy, which works well for the continuous development environment we are setting up with this new project. Architecture validated, time to cover with testing!

I setup a Jest test like so:

import jestPlugin from 'serverless-jest-plugin';
import * as mod from '../myCustomResource';

const { lambdaWrapper } = jestPlugin;
const wrapped = lambdaWrapper.wrap(mod, { handler: 'handler' });
...
    const response = await wrapped.run({});

However, when running in the serverless-jest-plugin environment, I am getting an error:

 ● Test suite failed to run

    Cannot find module 'uuid/v4'

    > 1 | module.exports = () => require('uuid/v4')();

Which seems to be caused by this line in the serverless.yml:

        UUID: ${file(./uuid.js)}

This error seems to be isolated to the serverless-jest-plugin environment, since it is working w/o error when running serverless deploy.

Please advise,

-- Tim

"TypeError: serverless.classes.Variables is not a constructor" when invoking a test

When using the following versions:

"serverless": "^3.19.0",
"serverless-jest-plugin": "^0.4.0",

and executing npx sls invoke test

the following error is reported:

Error:
TypeError: serverless.classes.Variables is not a constructor
    at /home/franco/repos/palm-serverless/node_modules/serverless-jest-plugin/lib/run-tests.js:13:18
    at Promise._execute (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/debuggability.js:384:9)
    at Promise._resolveFromExecutor (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:518:18)
    at new Promise (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:103:10)
    at runTests (/home/franco/repos/palm-serverless/node_modules/serverless-jest-plugin/lib/run-tests.js:8:3)
    at ServerlessJestPlugin.<anonymous> (/home/franco/repos/palm-serverless/node_modules/serverless-jest-plugin/index.js:97:23)
    at ServerlessJestPlugin.tryCatcher (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromiseCtx (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:641:10)
    at _drainQueueStep (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/async.js:97:12)
    at _drainQueue (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (node:internal/timers:466:21)
    at process.topLevelDomainCallback (node:domain:152:15)
    at process.callbackTrampoline (node:internal/async_hooks:128:24)

It seems that on file run-tests.js, the lines 13 and 14 are not needed with the latest version of serverless.

Use template-literal instead of EJS

Template Literal is fastest, smallest and simplest template engine, because it use JS's literal template feature.

It's 55 times faster than EJS, and it also use less CPU and RAM ressources, so it may be a good idea to use it instead of EJS 😀

Deprecation warning from serverless relating to plugin

Serverless version: 2.52.0
Serverless-jest-plugin version: 0.3.0

sls create function -f myFunction --handler handlers/myFunction

This works, but shows a deprecation warning:

             - ServerlessJestPlugin for "function", "path", "handler", "reporter", "reporter-options"
            Please report this issue in plugin issue tracker.
            Starting with next major release, this will be communicated with a thrown error.
            More Info: https://www.serverless.com/framework/docs/deprecations/#CLI_OPTIONS_SCHEMA

Edit: Looks like a pull request is ready to go: #45

Serverless command "invoke test" not found. Run "serverless help" for a list of all available commands.

my current package.json configuration looks like

"scripts": {
    "deploy": "sls deploy",
    "test": "jest --coverage",
    "test:coverage": "npm run test -- --coverage --watchAll=false || exit 0"
  },
  "jest": {
    "collectCoverage": true,
    "verbose": true,
    "coverageReporters": [
      "json",
      "html"
    ],
    "coverageThreshold": {
      "global": {
        "branches": 90,
        "functions": 90,
        "lines": 90,
        "statements": 90
      }
    }
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "aws-sdk": "^2.930.0",
    "aws-sdk-mock": "^5.2.1",
    "cors": "^2.8.5",
    "joi": "^17.4.0",
    "lodash.get": "^4.4.2",
    "lodash.set": "^4.3.2",
    "moment": "^2.29.1",
    "serverless": "^1.83.3",
    "serverless-jest-plugin": "^0.3.0",
    "serverless-offline": "^4.10.6",
    "serverless-prune-plugin": "^1.5.0",
    "uuidv4": "^6.2.10"
  }

I run sls invoke test and it fails with the error

Jest does not exit when tests are finished running.

Jest offers a CLI flag called --forceExit Forces Jest to exit after all tests have completed running even if there are resources that have not yet been cleaned up. This is useful when resources set up by test code cannot be adequately cleaned up.

There is also a CLI flag called --detectOpenHandles Which attempts to collect and print open handles preventing Jest from exiting cleanly.

It would be great if we could set these two flags on the invoke test Serverless call.

The mocha-serverless-plugin allows something very similar see this issue

Several npm audit warnings relating to 'braces' module

The solution would appear to be upgrading Jest, as per issue #13

Click to expand full audit log ``` === npm audit security report ===
┌──────────────────────────────────────────────────────────────────────────────┐
│                                Manual Review                         │
│            Some vulnerabilities require your attention to resolve    │
│                                                                      │
│         Visit https://go.npm.me/audit-guide for additional guidance  │
└──────────────────────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path         │ serverless-jest-plugin > jest > jest-cli > jest-config > │
│              │ babel-jest > babel-plugin-istanbul > test-exclude >      │
│              │ micromatch > braces                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path         │ serverless-jest-plugin > jest > jest-cli > jest-config > │
│              │ jest-environment-jsdom > jest-util > jest-message-util > │
│              │ micromatch > braces                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path         │ serverless-jest-plugin > jest > jest-cli > jest-config > │
│              │ jest-environment-node > jest-util > jest-message-util >  │
│              │ micromatch > braces                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-config >     │
│               │ jest-jasmine2 > expect > jest-message-util > micromatch >    │
│               │ braces                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-config >     │
│               │ jest-jasmine2 > jest-message-util > micromatch > braces      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-config >     │
│               │ jest-jasmine2 > jest-snapshot > jest-message-util >          │
│               │ micromatch > braces                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-config >     │
│               │ jest-jasmine2 > jest-util > jest-message-util > micromatch > │
│               │ braces                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-config >     │
│               │ jest-util > jest-message-util > micromatch > braces          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-config >     │
│               │ micromatch > braces                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli >                   │
│               │ jest-environment-jsdom > jest-util > jest-message-util >     │
│               │ micromatch > braces                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-haste-map >  │
│               │ micromatch > braces                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-message-util │
│               │ > micromatch > braces                                        │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli >                   │
│               │ jest-resolve-dependencies > jest-snapshot >                  │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-config > babel-jest > babel-plugin-istanbul >           │
│               │ test-exclude > micromatch > braces                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-config > jest-environment-jsdom > jest-util >           │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-config > jest-environment-node > jest-util >            │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-config > jest-jasmine2 > expect > jest-message-util >   │
│               │ micromatch > braces                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-config > jest-jasmine2 > jest-message-util > micromatch │
│               │ > braces                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-config > jest-jasmine2 > jest-snapshot >                │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-config > jest-jasmine2 > jest-util > jest-message-util  │
│               │ > micromatch > braces                                        │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-config > jest-util > jest-message-util > micromatch >   │
│               │ braces                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-config > micromatch > braces                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-haste-map > micromatch > braces                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-jasmine2 > expect > jest-message-util > micromatch >    │
│               │ braces                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-jasmine2 > jest-message-util > micromatch > braces      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-jasmine2 > jest-snapshot > jest-message-util >          │
│               │ micromatch > braces                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-jasmine2 > jest-util > jest-message-util > micromatch > │
│               │ braces                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > babel-plugin-istanbul > test-exclude >        │
│               │ micromatch > braces                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > jest-config > babel-jest >                    │
│               │ babel-plugin-istanbul > test-exclude > micromatch > braces   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > jest-config > jest-environment-jsdom >        │
│               │ jest-util > jest-message-util > micromatch > braces          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > jest-config > jest-environment-node >         │
│               │ jest-util > jest-message-util > micromatch > braces          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > jest-config > jest-jasmine2 > expect >        │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > jest-config > jest-jasmine2 >                 │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > jest-config > jest-jasmine2 > jest-snapshot > │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > jest-config > jest-jasmine2 > jest-util >     │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > jest-config > jest-util > jest-message-util > │
│               │ micromatch > braces                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > jest-config > micromatch > braces             │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > jest-haste-map > micromatch > braces          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > jest-message-util > micromatch > braces       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > jest-snapshot > jest-message-util >           │
│               │ micromatch > braces                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > jest-util > jest-message-util > micromatch >  │
│               │ braces                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-runtime > micromatch > braces                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runner >     │
│               │ jest-util > jest-message-util > micromatch > braces          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ babel-plugin-istanbul > test-exclude > micromatch > braces   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ jest-config > babel-jest > babel-plugin-istanbul >           │
│               │ test-exclude > micromatch > braces                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ jest-config > jest-environment-jsdom > jest-util >           │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ jest-config > jest-environment-node > jest-util >            │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ jest-config > jest-jasmine2 > expect > jest-message-util >   │
│               │ micromatch > braces                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ jest-config > jest-jasmine2 > jest-message-util > micromatch │
│               │ > braces                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ jest-config > jest-jasmine2 > jest-snapshot >                │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ jest-config > jest-jasmine2 > jest-util > jest-message-util  │
│               │ > micromatch > braces                                        │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ jest-config > jest-util > jest-message-util > micromatch >   │
│               │ braces                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ jest-config > micromatch > braces                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ jest-haste-map > micromatch > braces                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ jest-snapshot > jest-message-util > micromatch > braces      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ jest-util > jest-message-util > micromatch > braces          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-runtime >    │
│               │ micromatch > braces                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-snapshot >   │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > jest-util >       │
│               │ jest-message-util > micromatch > braces                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low          │ Regular Expression Denial of Service                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package      │ braces                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in   │ >=2.3.1                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ serverless-jest-plugin [dev]                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ serverless-jest-plugin > jest > jest-cli > micromatch >      │
│               │ braces                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info    │ https://nodesecurity.io/advisories/786                 │
└───────────────┴──────────────────────────────────────────────────────────────┘
```

Jest in Watch mode

Hi all,

I found this thread about starting Jest in watch mode for a serverless project but didn't want to post in this old thread:
#8

I couldn't find any info if this is possible now.
Could you please give me some tips about how to get watch-mode running with a serverless project running?

aws-nodejs8.10 not supported

Node v10 (serverless-mocha-plugin works ok) but:

Running this:
sls create function -f myFunction --handler functions/myFunction2/index.handler

Returns this:
Serverless: Generating function...

Serverless Error ---------------------------------------

Provider / Runtime "aws-nodejs8.10" is not supported. Supported runtimes are: "aws-nodejs4.3", "aws-nodejs6.10".

Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com

Your Environment Information -----------------------------
OS: win32
Node Version: 10.0.0
Serverless Version: 1.27.2

POST body Howto

Hi,

how the heck to send JSON body via POST-Request in tests? There are no examples.

Cheers,
Bernd

TypeError: Cannot create property 'ejs' on boolean 'true'

    TypeError: Cannot create property 'ejs' on boolean 'true'

      1 | const mod = require('../../dist/lambdas/query-item');
      2 | 
    > 3 | const jestPlugin = require('serverless-jest-plugin');
        |                    ^
      4 | 

Getting an error with sls invoke test...

Here is what my serverless.yml looks like

plugins:
  - serverless-offline
  - serverless-jest-plugin

...

custom:
  jest:
    collectCoverage: true
    collectCoverageFrom: "src/**/*.js"
    testURL: "http://localhost:3000"

aws-nodejs10.x not supported

Running this:
sls create function -f myFunction --handler functions/myFunction2/index.handler

Returns this:
Serverless: Generating function...

Serverless Error ---------------------------------------

ServerlessError: Provider / Runtime "aws-nodejs10.x" is not supported. Supported runtimes are: "aws-nodejs4.3", "aws-nodejs6.10", "aws-nodejs8.10".

Your Environment Information ---------------------------
Operating System: darwin
Node Version: 8.12.0
Framework Version: 1.57.0
Plugin Version: 3.2.2
SDK Version: 2.2.1
Components Core Version: 1.1.2
Components CLI Version: 1.4.0

TypeError: Path must be a string. Received undefined

I a persistent error while using serverless framework with serverless-offline and jest unit testing module.

I am trying to test my serverless function (lambda) using serverless-jest-plugin which is supposed to integrate jest on serverless. Following is my jest configuration in my serverless.yml:

custom:
 default:
  stage: dev
 table:
  dictionary: Dictionary
  rules: Rules
 jest:
  verbose: true
  testResultsProcessor: jest-junit
  modulePaths: ["<rootDir>/node_modules", "<rootDir>/lib"]
  roots: ["<rootDir>/tests"]
  testEnvironment: node
plugins:
   - serverless-jest-plugin
   - serverless-dynamodb-local
   - serverless-offline

I have a lambda function which uses dynamoDB to get some data etc.

Whenever I use sls invoke test I have the following:

$ sls invoke test
 FAIL  tests/file.test.js
  ● Test suite failed to run

TypeError: Path must be a string. Received undefined
  
  at assertPath (path.js:7:11)
  at Object.relative (path.js:1226:5)
  at process._tickDomainCallback (internal/process/next_tick.js:135:7)
Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.386s
Ran all test suites.

I'm running the following package.json:

{
  "dependencies": {
    "ajv": "^6.1.1",
    "async": "^2.6.0",
    "aws-sdk": "^2.188.0",
    "notevil": "^1.1.0"
  },
  "devDependencies": {
    "jest": "^22.2.1",
    "jest-junit": "^3.5.0",
    "serverless-dynamodb-local": "^0.2.27",
    "serverless-jest-plugin": "^0.1.6",
    "serverless-offline": "^3.16.0"
  }
}

Cheers.

testRegex cannot be overridden, does not run all tests

Currently, it is not possible to override the testRegex Jest configuration setting due to the way that the configuration is being prepared before being provided to Jest:

      const functionsRegex = allFunctions.map(name => `${name}\\.test\\.js$`).join('|');
      Object.assign(config, { testRegex: functionsRegex });

If that were simply changed to this, then it would be possible to override the setting:

      const functionsRegex = allFunctions.map(name => `${name}\\.test\\.js$`).join('|');
      Object.assign(config, { testRegex: functionsRegex }, config);

The default Jest testRegex is defined as (/__tests__/.*|(\\.|/)(test|spec))\\.jsx?$, which allows for the .test. portion of the filename to be optional - the current value for testRegex being applied, however, does not.

In addition to supporting overriding the testRegex setting, do you think it would make sense to support a command-line argument for running all found tests and not just the ones related to serverless functions? Otherwise, I'm not sure how we are supposed to test the functions via this plugin and everything else separately without something failing or causing issues.

serverless.yml jest configuration not being honored

I just discovered that the serverless.yml jest configuration settings are not being honored by jest since the v23 update. The fix is quite simple - within https://github.com/SC5/serverless-jest-plugin/blob/master/lib/run-tests.js#L32

return runCLI({ config }, [serverless.config.servicePath], success => resolve(success));

simply needs to be changed to:

return runCLI(config, [serverless.config.servicePath], success => resolve(success));

and that appears to resolve the issue.

I'm working on a PR, but putting together some test coverage that doesn't significantly increase the duration of the tests is taking a little bit of time. Should have something ready in a little bit, but I just wanted to raise the issue in case anyone else gets to it more quickly.

serverless.classes.Variables is not a constructor

Error when executing invoke test

my sample invoke command: serverless invoke test --stage dev --region us-east-1 -f getPartners

after hitting enter:

Error:
TypeError: serverless.classes.Variables is not a constructor
at C:\Node JS Self Learnings\CICO boilerplate\node_modules\serverless-jest-plugin\lib\run-tests.js:13:18
at Promise._execute (C:\Node JS Self Learnings\CICO boilerplate\node_modules\bluebird\js\release\debuggability.js:384:9)
at Promise._resolveFromExecutor (C:\Node JS Self Learnings\CICO boilerplate\node_modules\bluebird\js\release\promise.js:518:18)
at new Promise (C:\Node JS Self Learnings\CICO boilerplate\node_modules\bluebird\js\release\promise.js:103:10)
at runTests (C:\Node JS Self Learnings\CICO boilerplate\node_modules\serverless-jest-plugin\lib\run-tests.js:8:3)
at ServerlessJestPlugin. (C:\Node JS Self Learnings\CICO boilerplate\node_modules\serverless-jest-plugin\index.js:97:23)
at ServerlessJestPlugin.tryCatcher (C:\Node JS Self Learnings\CICO boilerplate\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Node JS Self Learnings\CICO boilerplate\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\Node JS Self Learnings\CICO boilerplate\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromiseCtx (C:\Node JS Self Learnings\CICO boilerplate\node_modules\bluebird\js\release\promise.js:641:10)
at _drainQueueStep (C:\Node JS Self Learnings\CICO boilerplate\node_modules\bluebird\js\release\async.js:97:12)
at _drainQueue (C:\Node JS Self Learnings\CICO boilerplate\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (C:\Node JS Self Learnings\CICO boilerplate\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (C:\Node JS Self Learnings\CICO boilerplate\node_modules\bluebird\js\release\async.js:15:14)
at processImmediate (node:internal/timers:466:21)

how to include and run jest tests in AWS serverless lambda function in CD

hello there,

I am currenty working on letting AWS serverless lambda run the jest test in CD(continuous development) process.
I have many test files named '....test.ts'. I created a handler that will turn into a serverless lambda function.
In the handler, jest.runCLI... or execSync("npm run jest")... will run.
So, the function is not open API, but dedicated to only testing.
AFAIK, serverless only takes the minimal form of transpiled(compiled) js codes.
However, the handler does not have any direct dependencies on the test files.
So, all the test files are not going to be included in the lambda function.

is there any ways to let the lambda function search and include all the jest test files so that I can run all the tests under serverless (by sls invoke ...)

I hope there is a simple way to achieve this just by playing with some options in yml file.

Upgrade to Jest v21

This will be a little work because the Jest CLI was re-written with v21 which just recently came out. The runCLI options appear to have been changed and there is little documentation that I can see.

serverless-jest-plugin does not trigger other plugins before running tests. (webpack for example)

cross posted here: serverless-heaven/serverless-webpack#143

Seems like the test runner is not loading other plugins before running the tests. There is a suggestion at the discussion linked above.
@laardee any thoughts on this?

Description

I'm trying to ensure that webpack runs before the testing plugin.

It appears tests are running the uncompiled code (not using webpack), and also using the node version. This means I'm not catching all the syntax errors lambda runtime does not support.

Reproduction

It's a bit tricky to reproduce this error, since you'd have to compare the jest test run results to that of a deployed function.
You can break the webpack integration by breaking the config file :

module.exports = {
  entry: null,
...

The test runner will not catch this error, which implies that webpack is not running before the tests.
The only way to catch this is by running serverless webpack serve

Additional Data

package.json

    "babel-core": "^6.13.2",
    "babel-loader": "^6.2.4",
    "babel-plugin-transform-runtime": "^6.12.0",
    "babel-polyfill": "6.13.0",
    "babel-preset-es2015": "^6.13.2",
    "babel-preset-stage-0": "^6.5.0",
    "serverless-jest-plugin": "^0.1.5",
    "serverless-webpack": "^1.0.0-rc.3",
    "webpack": "^1.13.1"

serverles.yml

plugins:
  - serverless-jest-plugin
  - serverless-webpack

Error: expect(received).toBe(expected) // Object.is equality

I have written an API to sign-in which works perfectly fine on Postman. Have written a test for the same but the test fails. Attaching the error and test written. Please provide a solution for same.

'use strict';

// tests for view_sneaker_room
// Generated by serverless-jest-plugin

const mod = require('./../src/routes/sign_in');

const jestPlugin = require('serverless-jest-plugin');
const lambdaWrapper = jestPlugin.lambdaWrapper;
const wrapped = lambdaWrapper.wrap(mod, { handler: 'handler' });
const testUserEmail = '[email protected]';
const testPassword= 'Admin@123';
jest.setTimeout(30000);

describe('signIn', () => {
  beforeAll((done) => {
//  lambdaWrapper.init(liveFunction); // Run the deployed lambda

    done();
  });

  // it('verify response', () => {
  //   return wrapped.run({ queryStringParameters: { email: testUserEmail, password: testPassword} }).then((response) => {
  //     expect(response).toBeDefined();
  //   });
  // });
  it('200 works', () => {
    return wrapped.run({ queryStringParameters: { email: testUserEmail,password: testPassword} }).then((response) => {
      console.log("response :",response)
      expect(response.statusCode).toBe(200);
      expect(typeof response.body).toBe('string');
      expect(response.headers['Content-Type']).toBe('application/json');
    });
  });
});

image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.