Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50655 views
1
/*
2
* spin-test.js: Tests for spin restarts in forever-monitor.
3
*
4
* (C) 2010 Nodejitsu Inc.
5
* MIT LICENCE
6
*
7
*/
8
9
var assert = require('assert'),
10
path = require('path'),
11
vows = require('vows'),
12
fmonitor = require('../../lib');
13
14
vows.describe('forever-monitor/monitor/fork').addBatch({
15
"When using forever-monitor": {
16
"and spawning a script that uses `process.send()`": {
17
"using the 'native' fork": {
18
topic: function () {
19
var script = path.join(__dirname, '..', '..', 'examples', 'process-send.js'),
20
child = new (fmonitor.Monitor)(script, { silent: false, minUptime: 2000, max: 1, fork: true });
21
22
child.on('message', this.callback.bind(null, null));
23
child.start();
24
},
25
"should reemit the message correctly": function (err, msg) {
26
assert.isObject(msg);
27
assert.deepEqual(msg, { from: 'child' });
28
}
29
}
30
}
31
}
32
}).export(module);
33
34