diff --git a/test/parallel/test-cluster-ipc-throw.js b/test/parallel/test-cluster-ipc-throw.js new file mode 100644 index 00000000000000..ead54b8e0ffc0f --- /dev/null +++ b/test/parallel/test-cluster-ipc-throw.js @@ -0,0 +1,22 @@ +'use strict'; +const common = require('../common'); +const http = require('http'); +const cluster = require('cluster'); + +const server = http.createServer(); +if (cluster.isMaster) { + server.listen(common.PORT); + const worker = cluster.fork(); + worker.on('exit', common.mustCall(() => { + server.close(); + })); +} else { + process.on('uncaughtException', common.mustCall((e) => { + })); + + server.listen(common.PORT); + server.on('error', common.mustCall((e) => { + cluster.worker.disconnect(); + throw e; + })); +}