Browse Source

test: change call to deprecated util.isError()

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 <mic.besace@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
v4.x
Rich Trott 9 years ago
committed by James M Snell
parent
commit
b5f3b4956b
  1. 21
      test/parallel/test-tty-stdout-end.js

21
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);

Loading…
Cancel
Save