Closed andrewoh531 closed 7 years ago
For compatibility reasons we are not supporting async/await and other ES7 features until AWS Lambda rolls out support for Node.js version 7. Once these features have been rolled out by AWS we will look at support for async/await.
Ok no problem. Thanks for responding back.
Hello, is this possible now that Lamda supports Node 8?
@jamesdixon I have used lambda-tester with async handler functions by using expectResolve and expectReject rather than expectResult and expectError.
ex. handler
// in handler
export const handler = async (event, context) => {
const promise = new Promise(resolve => { resolve("success!") });
return await promise();
}
// in unit test
describe('Async', () => {
it('works with async', () => {
return LambdaTester(MyLambda.handler)
.expectResolve(result => {
assert.equal(result, "success!");
});
}
}
I keep getting Error: Promise.reject() called instead of Promise.resolve()
I had a quick look at the code and I'm assuming it's not possible in its current state since the verifier is passed in to the
expectResult
method. Is that right?