node/test/parallel/test-repl-domain.js
Rich Trott 337d2dd381 test: implement consistent braces
This change is in preparation for lint enforcement of brace style.

PR-URL: https://github.com/nodejs/node/pull/8348
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2016-10-26 14:08:53 -04:00

23 lines
567 B
JavaScript

'use strict';
var common = require('../common');
var repl = require('repl');
const putIn = new common.ArrayStream();
repl.start('', putIn);
putIn.write = function(data) {
// Don't use assert for this because the domain might catch it, and
// give a false negative. Don't throw, just print and exit.
if (data === 'OK\n') {
console.log('ok');
} else {
console.error(data);
process.exit(1);
}
};
putIn.run([
'require("domain").create().on("error", function() { console.log("OK") })'
+ '.run(function() { throw new Error("threw") })'
]);