Help - Serverless-Mocha-Plugin

Hey Everyone. I have been using serverless for a while now, however this is the first time I’m trying to use mocha for writing tests. When I’m trying to run the following sls create test --function insiders/create.create I get the following error Cannot read property 'handler' of undefined. This is how my serverless.yml looks like for the handler I have created

    handler: insiders/create.create
      - http:
          path: insiders
          method: post
          cors: true

The code is deployed and it works fine. The namespacing is as insiders/create.js is where I have defined my function.

module.exports.create = () => {}

I have also tried the following ways

sls create test --function insiders/create

sls create test --function create

Hi Kedarnag13!

You need to use the alias name of your function.

sls create test -f createInsider


Thank you. I figured it out a while ago.