summaryrefslogtreecommitdiff
path: root/node_modules/forever/test/core/tail-stopall-test.js
diff options
context:
space:
mode:
authoryo mama <pepper@scannerjammer.com>2015-04-04 01:00:59 -0700
committeryo mama <pepper@scannerjammer.com>2015-04-04 01:00:59 -0700
commitc7c22e3db1c826bcfb2bc66651ec480aae0d4ae0 (patch)
tree8546df448afef40d3814d2581f4dacff7cebb87f /node_modules/forever/test/core/tail-stopall-test.js
Diffstat (limited to 'node_modules/forever/test/core/tail-stopall-test.js')
-rw-r--r--node_modules/forever/test/core/tail-stopall-test.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/node_modules/forever/test/core/tail-stopall-test.js b/node_modules/forever/test/core/tail-stopall-test.js
new file mode 100644
index 0000000..973d0b9
--- /dev/null
+++ b/node_modules/forever/test/core/tail-stopall-test.js
@@ -0,0 +1,47 @@
+/*
+ * tail-stopall-test.js: Tests for forever.tail() and forever.stopAll()
+ *
+ * (C) 2010 Nodejitsu Inc.
+ * MIT LICENCE
+ *
+ */
+
+var assert = require('assert'),
+ path = require('path'),
+ spawn = require('child_process').spawn,
+ vows = require('vows'),
+ forever = require('../../lib/forever');
+
+vows.describe('forever/core/tail').addBatch({
+ "When using forever": {
+ "the tail() method": {
+ topic: function () {
+ var that = this;
+
+ that.child = spawn('node', [path.join(__dirname, '..', 'fixtures', 'start-daemon.js')]);
+ setTimeout(function () {
+ forever.tail(0, { length: 1 }, that.callback);
+ }, 2000);
+ },
+ "should respond with logs for the script": function (err, procs) {
+ assert.isNull(err);
+ assert.equal(typeof procs, 'object');
+ assert.ok(procs.file);
+ assert.ok(procs.pid);
+ assert.ok(procs.line);
+ }
+ }
+ }
+}).addBatch({
+ "When the tests are over": {
+ "stop all forever processes": {
+ topic: function () {
+ forever.stopAll().on('stopAll', this.callback.bind(null, null));
+ },
+ "should stop the correct number of procs": function (err, procs) {
+ assert.isArray(procs);
+ assert.lengthOf(procs, 1);
+ }
+ }
+ }
+}).export(module);