From 9cfec12e9793ad72eff6b6969cca3e583374c36e Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 26 Sep 2015 16:29:41 -0700 Subject: [PATCH 1/3] test: change call to deprecated util.isError() --- test/parallel/test-tty-stdout-end.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-tty-stdout-end.js b/test/parallel/test-tty-stdout-end.js index 190acae42870a9..3c9fcb01aa77f3 100644 --- a/test/parallel/test-tty-stdout-end.js +++ b/test/parallel/test-tty-stdout-end.js @@ -9,7 +9,7 @@ try { process.stdout.end(); } catch (e) { exceptionCaught = true; - assert.ok(common.isError(e)); + assert.ok(e instanceof Error); assert.equal('process.stdout cannot be closed.', e.message); } From 5176a8f6e8125b10793cde80aa3cd6ada916aee0 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 28 Sep 2015 20:56:08 -0700 Subject: [PATCH 2/3] test: switch to assert.throws() --- test/parallel/test-tty-stdout-end.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-tty-stdout-end.js b/test/parallel/test-tty-stdout-end.js index 3c9fcb01aa77f3..ba203aec8aa097 100644 --- a/test/parallel/test-tty-stdout-end.js +++ b/test/parallel/test-tty-stdout-end.js @@ -3,14 +3,13 @@ var common = require('../common'); var assert = require('assert'); -var exceptionCaught = false; - -try { +var shouldThrow = function() { process.stdout.end(); -} catch (e) { - exceptionCaught = true; - assert.ok(e instanceof Error); - assert.equal('process.stdout cannot be closed.', e.message); -} +}; + +var validateError = function(e) { + return e instanceof Error && + e.message === 'process.stdout cannot be closed.'; +}; -assert.ok(exceptionCaught); +assert.throws(shouldThrow, validateError); From 3210cb89fa053cb9168b9ba0c74c5e4dbe230a58 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 28 Sep 2015 20:56:41 -0700 Subject: [PATCH 3/3] test: var -> const --- test/parallel/test-tty-stdout-end.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-tty-stdout-end.js b/test/parallel/test-tty-stdout-end.js index ba203aec8aa097..57f9c03ec449e9 100644 --- a/test/parallel/test-tty-stdout-end.js +++ b/test/parallel/test-tty-stdout-end.js @@ -1,13 +1,13 @@ 'use strict'; // Can't test this when 'make test' doesn't assign a tty to the stdout. -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); -var shouldThrow = function() { +const shouldThrow = function() { process.stdout.end(); }; -var validateError = function(e) { +const validateError = function(e) { return e instanceof Error && e.message === 'process.stdout cannot be closed.'; };