From b5f3b4956b20a25c14adee30b9018071504eddc9 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 26 Sep 2015 16:29:41 -0700 Subject: [PATCH] test: change call to deprecated util.isError() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit common.Error() is just util.isError() which is deprecated. Use assert.throws() instead. PR-URL: https://github.com/nodejs/node/pull/3084 Reviewed-By: Michaël Zasso Reviewed-By: Сковорода Никита Андреевич --- test/parallel/test-tty-stdout-end.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/test/parallel/test-tty-stdout-end.js b/test/parallel/test-tty-stdout-end.js index 190acae42870a9..57f9c03ec449e9 100644 --- a/test/parallel/test-tty-stdout-end.js +++ b/test/parallel/test-tty-stdout-end.js @@ -1,16 +1,15 @@ '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 exceptionCaught = false; - -try { +const shouldThrow = function() { process.stdout.end(); -} catch (e) { - exceptionCaught = true; - assert.ok(common.isError(e)); - assert.equal('process.stdout cannot be closed.', e.message); -} +}; + +const validateError = function(e) { + return e instanceof Error && + e.message === 'process.stdout cannot be closed.'; +}; -assert.ok(exceptionCaught); +assert.throws(shouldThrow, validateError);