Skip to content

Test doesn't reload automatically #4911

Closed Answered by lexuzieel
lexuzieel asked this question in Help
Discussion options

You must be logged in to vote

I have figured this out on my own: the cause was that I was opening postgres connection in a module outside of the service container, which didn't provide any way to close said connection. This caused adonis to "hang" waiting for the connection.

Because of this neither test reloading, nor commands such as node ace migrate:run worked correctly - they were waiting for connection to close.

I have solved this issue by restructuring my project code and putting connection logic into service & bootstrapping it using service provider.
This way I was able to terminate the connection explicitly in the shutdown() container hook.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lexuzieel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant