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

test: add tests for error handling #5451

Merged
merged 4 commits into from
May 14, 2024
Merged

Conversation

domdomegg
Copy link
Contributor

These are failing tests to show that #5445 does not fix #5220

Checklist

// In this test file numbered comments indicate the order statements are expected to execute

test('encapsulates an asynchronous error handler', async t => {
t.plan(4)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
t.plan(4)
t.plan(3)

Why t.plan is 4 but not 3?
I can see three t.equal only and none of the code path run twice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one missing @domdomegg

test/encapsulated-error-handler.test.js Outdated Show resolved Hide resolved
@mcollina
Copy link
Member

mcollina commented May 7, 2024

@domdomegg would you also add a fix?

@domdomegg domdomegg closed this May 8, 2024
@domdomegg
Copy link
Contributor Author

Hi folk, it's been a while since I've looked at the fastify code, especially since #5222 which this is based off.

I think I was wrong here, and I think #5445 does fix it. Think I've confused myself with misunderstanding some of the errors from the tap test runner 🤦, thank you @climba03003 for flagging this.

Glad this is all finally sorted :)

@climba03003
Copy link
Member

@domdomegg I think this PR still worth merging. Would you consoder re-open and fix the test plan?

@domdomegg domdomegg deleted the 5220-tests branch May 10, 2024 23:39
@domdomegg domdomegg restored the 5220-tests branch May 10, 2024 23:39
@domdomegg domdomegg reopened this May 10, 2024
@gurgunday gurgunday changed the title Add tests for error handling test: Add tests for error handling May 10, 2024
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@climba03003 climba03003 changed the title test: Add tests for error handling test: add tests for error handling May 14, 2024
@climba03003 climba03003 merged commit 47f2375 into fastify:main May 14, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

crash: errors thrown in a hook and then rethrown by an error handler crash fastify
4 participants