You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Throw error when getTestDatabase() is called inside beforeTemplateIsBaked() instead of hanging #15
@codetheweb I have no idea how to do that, I tried to search for solutions, but all of them seem flaky. Do you have any suggestions? I believe a good decision is to have good documentation about this
I think (if I remember correctly) it's hanging because:
the worker sends the test process a request to run the beforeTemplateIsBaked() hook
the test process begins running the hook
as part of the hook, the test process makes a new GET_TEST_DATABASE request to the worker
the worker ignores the message because it's not the expected response (the result of the beforeTemplateIsBaked() hook) and everything hangs
So we just need to add detection of the GET_TEST_DATABASE message type to the worker when in the context of waiting for the result of beforeTemplateIsBaked() and throw.
Activity
itelo commentedon May 8, 2023
@codetheweb I have no idea how to do that, I tried to search for solutions, but all of them seem flaky. Do you have any suggestions? I believe a good decision is to have good documentation about this
codetheweb commentedon May 8, 2023
Sure, some debug logging might be helpful in tracking down the issue but I believe it hangs somewhere in this function:
ava-postgres/src/worker.ts
Line 42 in 805474d
I think (if I remember correctly) it's hanging because:
beforeTemplateIsBaked()hookGET_TEST_DATABASErequest to the workerbeforeTemplateIsBaked()hook) and everything hangsSo we just need to add detection of the
GET_TEST_DATABASEmessage type to the worker when in the context of waiting for the result ofbeforeTemplateIsBaked()and throw.