[Solved] mocha/chai.js testing harness: https calls do not work from after() function


I believe I have found a solution. In after(), if you asynchronously invoke some endpoint on a service external to your testing environment, then that asynchronous call is queued and not immediately executed. This is the nature of calling asynchronous functions in node.js. Well, if there is no logic after the after() call, then mocha immediately exits by invoking process.exit()! The end-result is that your asynchronous call to an external endpoint remains queued and never invoked.

Resolution: inside mocha.opts under your test directory, just install the option --no-exit.

2

solved mocha/chai.js testing harness: https calls do not work from after() function