Node.js mocha process (_mocha) doesn't exit upon CTRL-C -
when mocha
test takes while complete, hitting ctrl-c exits mocha
command doesn't exit test runner, "_mocha", , test continues. know if design?
/* * test/mocha-kill-test.js */ describe("mocha timeout test", function() { this.timeout(10e3); it("should exit when hitting ctrl-c", function(done) { var count = 0; var timer = setinterval(function() { if (count++ < 10) { console.log(" wait " + count); } else { console.log(" done"); clearinterval(timer); done(); } }, 1e3); }); });
this test run 10 seconds , exit. if try interrupt terminal ctrl-c (or otherwise send sigint), test runner continue run , you'll see in shell.
shell> mocha test/mocha-kill-test.js wait 1 wait 2 ^cshell> wait 3 wait 4 wait 5 wait 6 wait 7 wait 8 wait 9 wait 10 done ․ 1 passing (11s)
i see mocha
supposed catch sigint , runner.abort()
can't intended behavior, right?
node v0.10.26
mocha 1.18.2
quoting mocha's supporter feedback issue: "you need ensure code mocha running stops @ point."
see link below more details:
https://github.com/mochajs/mocha/issues/1362
according other developers code below keep mocha process alive after trying kill ctrl+c:
echo "while(1);" > file.js mocha -w file.js
Comments
Post a Comment