0.0.9 • Published 7 years ago

serverless-flow-plugin v0.0.9

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

Serverless-Flow

A lightweight testing framework for the Serverless Framework.

Features

  • Write mock events and invoke your functions with them while you write code.
  • On save, this plugin automatically invokes your Function w/ each mock event and prints results in your console.
  • Features a local or remote mode. remote mode will quickly deploy your function before invoking it with mock data.
  • Write multiple mock events for each event for your functions.

Quick-Start

Install with npm:

npm i serverless-flow-plugin --save

Add it to your Serverless Service plugins:

plugins
  - serverless-flow-plugin

Add a mock property to your Functions:

# serverless.yml

functions
  hello
    handler: index.hello
    events:
      - http:
          path: hello
          method: get
          mocks: ${file(./mocks.yml):hello} # References to another file which contains the mocks

Create a mocks.yml file in your service folder:

# mocks.yml

hello_http: # Contains the mock for the "hello" function and "http" event
  succcess: # A mock for this function event
    query:
      clientId: aslkfjasf8kajsf981
  fail: # Another mock for this function event
    query:
      clientId: false

Start the plugin:

sls flow --function hello

Write code, hit save, and your function will be auto-invoked for each mock.

When you're done working locally, switch the mode to remote to test your mocks against live Lambdas

sls flow --function hello --mode remote // Remote mode invokes the function on Lambda
0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago

0.0.0

8 years ago