Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Fixes doc list typo #1068

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion website/docs/intro/06-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ This page is a work in progress. If you want to help us to make this page better

As of Middy v3, by default it will trigger an Abort signal shortly before a lambda times out to allow your handler to safely stop up and middleware to clean before the lambda terminates.
When writing tests for lambda handlers wrapped with middy you'll need to account for this. There are a few approaches:
3. Set `context.getRemainingTimeInMillis = falsy` to disable the creation of the AbortController.

1. Set `middy(handler, { timeoutEarlyInMillis: 0 })` to alternatively disable the creation of the AbortController.
2. Set `middy(handler, { timeoutEarlyResponse: () => {} })` to disable the timeout error from being thrown using a no-op.
3. Set `context.getRemainingTimeInMillis = falsy` to disable the creation of the AbortController.

When using Middy `cache` and `cacheExpiry` in unit tests for functions in your code, it is important to conditionally disable them for test cases by setting both Middy `options` fields as follows:

Expand Down