Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5bbc6df

Browse filesBrowse 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 <mic.besace@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
1 parent 87e820e commit 5bbc6df
Copy full SHA for 5bbc6df

File tree

Expand file treeCollapse file tree

1 file changed

+10
-11
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-11
lines changed
Open diff view settings
Collapse file
+10-11Lines changed: 10 additions & 11 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.