Hey Smadar! 👋
As far as I can understand, mocha should definitely drop you back to the terminal after it runs the tests (unless you run it with the --watch parameter, of course). 🤔
So, what I’d do in cases like these is I’d reduce the context to the minimum: I’d to move all the test files to a safe place, out of the test directory, and create an empty-ish test file, something like this:
describe('file1', function() {
it('runs', function() {
// TODO: put assertions here
});
});
If that runs to completion and drops me back to the terminal after it runs the “test” — this is my first little success! 🤓
Now I will begin copy-pasting the contents of the real tests (that I just moved away) into this new one, piece by piece, and after each little step I’d make sure that it still runs to completion and drops me back to the terminal. One small (but sure!) step at a time. 🙂
My suspicion is that some of the code involved in the tests—probably the production code—holds the Node process. I’m thinking it may be listening to the network as an HTTP server does, or just waiting for some input, which could be the case for a console app.
In any case, I’d give it a try and see what comes out. 🙂
Good luck! 🤓