mirror of https://github.com/lukechilds/node.git
Browse Source
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
1 changed files with 10 additions and 11 deletions
@ -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…
Reference in new issue