lambda-tester
lambda-tester copied to clipboard
TypeScript definitions
Really nice helper, using this in my project a lot. But should I expect TypeScript definitions anytime soon?
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.
@ivank : awesome, thanks!
Is there any way to add noVersionCheck ?
@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.