Open
Description
Description
I started using the eager
flag on some of my @Services
that I would expect to be started as soon as they are registered (Database, Logger, Mailer, etc) which works great π
However when unit testing, these services are registering themselves during tests that don't require them and then beginning their start up routines (initializing connections etc) which causes tests to fail or have other issues
Proposed solution
Would it be possible to set some configuration on the Container to instruct it to ignore eager services when testing?
Other alternatives I've tried/thought about
- Mocking the eager services in a
setupTests
file (however this didn't seem to work, they are still registered then starting up) - I suppose I could remove the
this.start()
calls from the service's constructors, but then I'll have toget
them from the container to manually callstart()
on them (which sort of defeats the purpose of the eager π)
Thanks