aboutsummaryrefslogtreecommitdiffstats
path: root/tools/node_modules/expresso/test/earlyexit.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/node_modules/expresso/test/earlyexit.test.js')
-rw-r--r--tools/node_modules/expresso/test/earlyexit.test.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/node_modules/expresso/test/earlyexit.test.js b/tools/node_modules/expresso/test/earlyexit.test.js
new file mode 100644
index 0000000..9c36c10
--- /dev/null
+++ b/tools/node_modules/expresso/test/earlyexit.test.js
@@ -0,0 +1,22 @@
+var assert = require('assert');
+var spawn = require('child_process').spawn;
+
+exports['early exit'] = function(beforeExit) {
+ var completed = false;
+
+ var proc = spawn('bin/expresso', ['test/earlyexit/forever.test.js', '--port', '23444']);
+ proc.on('exit', function(code) {
+ completed = true;
+ assert.equal(1, code, "assert.response didn't report an error while still running");
+ });
+
+ setTimeout(function() {
+ proc.kill('SIGINT');
+ }, 1000);
+
+ // Also kill the child if it still exists.
+ beforeExit(function() {
+ proc.kill();
+ assert.ok(completed);
+ });
+}; \ No newline at end of file