-
Hey everyone, this is a follow-up to my question https://github.com/orgs/adonisjs/discussions/4910 where on further inspection I noticed that I also don't get automatic test reruns. Context: I run Japa tests using In particular, I've noticed that the process doesn't exit unless I press Ctrl+C or exit the terminal (so I guess it tries to watch the files?) Here is the output I get:
after running the following command: cd <project-path> && npm run test -- --files "tests/unit/project.spec.ts" --tests "create project with UUID" If I add --watch flag to the command I get slightly different output but it still doesn't watch for the updates:
Any help will be highly appreciated because right now I'm stuck :( Thanks in advance! ❤️ On further research I found that changing However as it currently stands I have no idea how to debug it. I have only 2 non-default providers enabled: lucid and my own. I can disable my own, but it doesn't affect anything. Could it be because I somehow need to teardown lucid service? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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 I have solved this issue by restructuring my project code and putting connection logic into service & bootstrapping it using service provider. |
Beta Was this translation helpful? Give feedback.
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.