Closed joeytwiddle closed 4 years ago
Thank you @joeytwiddle for reporting the problem! I vaguely remember that some of LB connectors may be keeping the process running because of the connection pool they use in background (and don't unref
it as they should).
I think it will be best to add --exit
to the mocha opts file template we use for new projects. Would you like to contribute this change?
@strongloop/loopback-maintainers any objections or other proposals?
Hi, I am currently having a similar problem on a loopback project when using the mssql connector, so I wanted to contribute. I can confirm that enabling the exit option for mocha solved the problem.
I'm leaving a comment just to let others know that I want to take care of this issue.
Thanks @simlt. Let me assign it to you.
closing as done via #6475
Description / Steps to reproduce / Feature proposal
npm test
Current Behavior
After the tests have passed, mocha blocks. The process never ends.
Expected Behavior
After the tests have passed, mocha should exit back to the command-line.
Additional
I guess that
--exit
is the desired behaviour, because I see it inpackages/build/config/mocha.opts
.But it doesn't appear in
generators/project/templates/test/mocha.opts
(if it did then I guess that would close the issue).The change happened somewhere between version 1.0.0 and 1.0.1 of @loopback/build
It looks like the new behaviour is to only use the default
mocha.opts
if there is notest/mocha.opts
in the project.Whether
--exit
is really desirable is up to you! But I feel the "default fallback" opts should be closer to the "template default".Workaround for consumers
When I encountered this problem, I simply added
--exit
to our project'stest/mocha.opts
to fix it.Another workaround might be to find and destroy whatever is keeping the mocha process alive. You may use why-is-node-running to help with that.
Acceptance criteria
"exit": true
to default Mocha options in scaffolded projects - seepackages/cli/generators/project/templates/.mocharc.json
š Hacktoberfest 2020
Greetings :wave: to all Hacktoberfest 2020 participants!
Here are few tips š to make your start easier, see also #6456:
#loopback-contributors
channel, you can join our Slack workspace here.