Skip to content

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

Open

Description

@codetheweb

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

Activity

  1. itelo commented on May 8, 2023

    @itelo
    Contributor

    @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

  2. codetheweb commented on May 8, 2023

    @codetheweb
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions