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

Throw error when getTestDatabase() is called inside beforeTemplateIsBaked() instead of hanging #15

Open
codetheweb opened this issue Mar 20, 2023 · 2 comments
Labels
good first issue Good for newcomers

Comments

@codetheweb
Copy link
Contributor

Also should document this behavior in the README and add a test.

@codetheweb codetheweb added the good first issue Good for newcomers label Mar 20, 2023
@itelo
Copy link
Contributor

itelo commented 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
Copy link
Contributor Author

Sure, some debug logging might be helpful in tracking down the issue but I believe it hangs somewhere in this function:

public async handleMessage(

I think (if I remember correctly) it's hanging because:

  1. the worker sends the test process a request to run the beforeTemplateIsBaked() hook
  2. the test process begins running the hook
  3. as part of the hook, the test process makes a new GET_TEST_DATABASE request to the worker
  4. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants