Skip to content

Commit 5bbc6df

Browse files
committed
test: change call to deprecated util.isError()
common.Error() is just util.isError() which is deprecated. Use assert.throws() instead. PR-URL: #3084 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]>
1 parent 87e820e commit 5bbc6df

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

test/parallel/test-tty-stdout-end.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
'use strict';
22
// Can't test this when 'make test' doesn't assign a tty to the stdout.
3-
var common = require('../common');
4-
var assert = require('assert');
3+
const common = require('../common');
4+
const assert = require('assert');
55

6-
var exceptionCaught = false;
7-
8-
try {
6+
const shouldThrow = function() {
97
process.stdout.end();
10-
} catch (e) {
11-
exceptionCaught = true;
12-
assert.ok(common.isError(e));
13-
assert.equal('process.stdout cannot be closed.', e.message);
14-
}
8+
};
9+
10+
const validateError = function(e) {
11+
return e instanceof Error &&
12+
e.message === 'process.stdout cannot be closed.';
13+
};
1514

16-
assert.ok(exceptionCaught);
15+
assert.throws(shouldThrow, validateError);

0 commit comments

Comments
 (0)