vandium-io / lambda-tester

Helper for unit testing AWS Lambda functions
BSD 3-Clause "New" or "Revised" License
272 stars 51 forks source link

TypeScript definitions #46

Open jovanmilenkoski opened 6 years ago

jovanmilenkoski commented 6 years ago

Really nice helper, using this in my project a lot. But should I expect TypeScript definitions anytime soon?

ivank commented 6 years ago

I stumbled on this package too and missed not having types for it. Opened a PR on DefinitelyTyped about it which just got merged, it should be in the npmjs registry in a couple of hours.

HajoAhoMantila commented 5 years ago

@ivank : awesome, thanks!

moikot commented 5 years ago

Is there any way to add noVersionCheck ?

chiubaca commented 4 years ago

@ivank I'm having a bad time with "@types/lambda-tester": "^3.6.0"

My tests keep failing with "error TS7006: Parameter 'result' implicitly has an 'any' type." I have no idea how to make this error go away. I hope you can help?

Here's what my simple unit test looks like (I'm using Jest):

  test("Access via GET is not allowed", async () => {
    await LambdaTester(handler)
      .event({ httpMethod: "GET" } as APIGatewayProxyEvent)
      .expectResult((result) => {
        return expect(result).toEqual({
          body: '{"error":"POST requests only"}',
          headers: {
            "Content-Type": "application/json"
          },
          statusCode: 405
        });
      });
  });

My workaround it to uninstall @types/lambda-tester and create blank declaration file with declare module "lambda-tester"; inside it.