Skip to content

Commit

Permalink
test: change call to deprecated util.isError()
Browse files Browse the repository at this point in the history
common.Error() is just util.isError() which is deprecated. Use
assert.throws() instead.

PR-URL: #3084
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
  • Loading branch information
Trott committed Oct 2, 2015
1 parent 87e820e commit 5bbc6df
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions test/parallel/test-tty-stdout-end.js
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 5bbc6df

Please sign in to comment.