Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

chai-http not exiting after running tests

I ran into a problem where my mocha tests were not finishing after running with chai-http. Mocha just hangs after the tests and eventually runs into a timeout (at least on my CI).

like image 760
El Mac Avatar asked Oct 15 '17 19:10

El Mac


1 Answers

Turns out, Mocha (4.0) changed their behavior regarding the termination of the tests. The best workaround I have found is to add the --exit flag to the npm script to revert to pre-4.0 behaviour.

...
"scripts": {
  "start": "node server.js",
  "test": "mocha --exit"
},
...
like image 156
El Mac Avatar answered Oct 19 '22 12:10

El Mac