Add test case for #83.

This commit is contained in:
Cheng Zhao 2013-09-05 09:21:39 +08:00
parent 3b7dd85d3f
commit ae18a90f7e
2 changed files with 18 additions and 0 deletions

11
spec/fixtures/module/fork_ping.js vendored Normal file
View file

@ -0,0 +1,11 @@
process.on('uncaughtException', function(error) {
process.send(error.stack);
});
var child = require('child_process').fork(__dirname + '/ping.js');
process.on('message', function(msg) {
child.send(msg);
});
child.on('message', function (msg) {
process.send(msg);
});

View file

@ -12,3 +12,10 @@ describe 'child_process', ->
assert.equal msg, 'message'
done()
child.send 'message'
it 'should work in forked process', (done) ->
child = child_process.fork path.join(fixtures, 'module', 'fork_ping.js')
child.on 'message', (msg) ->
assert.equal msg, 'message'
done()
child.send 'message'