summaryrefslogtreecommitdiff
path: root/test/parallel/test-console-instance.js
diff options
context:
space:
mode:
authormskec <martin.skec@gmail.com>2017-02-13 17:28:51 +0100
committerFranziska Hinkelmann <franziska.hinkelmann@gmail.com>2017-05-27 09:28:07 +0200
commit0ecdf2934039b6e847aa3d1441e3ec235a70d125 (patch)
tree4327c03cef84c51f1e01157eae3d978cb71a5979 /test/parallel/test-console-instance.js
parentae5e65c72f8db904f1596ada76cd0e695a88f16d (diff)
downloadandroid-node-v8-0ecdf2934039b6e847aa3d1441e3ec235a70d125.tar.gz
android-node-v8-0ecdf2934039b6e847aa3d1441e3ec235a70d125.tar.bz2
android-node-v8-0ecdf2934039b6e847aa3d1441e3ec235a70d125.zip
errors: migrate lib/console
Migrate console.js to use internal/errors.js. PR-URL: https://github.com/nodejs/node/pull/11340 Ref: https://github.com/nodejs/node/issues/11273 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'test/parallel/test-console-instance.js')
-rw-r--r--test/parallel/test-console-instance.js28
1 files changed, 20 insertions, 8 deletions
diff --git a/test/parallel/test-console-instance.js b/test/parallel/test-console-instance.js
index dee0cae543..1e68de3f6e 100644
--- a/test/parallel/test-console-instance.js
+++ b/test/parallel/test-console-instance.js
@@ -37,16 +37,28 @@ assert.strictEqual('function', typeof Console);
// make sure that the Console constructor throws
// when not given a writable stream instance
-assert.throws(() => {
- new Console();
-}, /^TypeError: Console expects a writable stream instance$/);
+assert.throws(
+ () => { new Console(); },
+ common.expectsError({
+ code: 'ERR_CONSOLE_WRITABLE_STREAM',
+ type: TypeError,
+ message: /stdout/
+ })
+);
// Console constructor should throw if stderr exists but is not writable
-assert.throws(() => {
- out.write = common.noop;
- err.write = undefined;
- new Console(out, err);
-}, /^TypeError: Console expects writable stream instances$/);
+assert.throws(
+ () => {
+ out.write = common.noop;
+ err.write = undefined;
+ new Console(out, err);
+ },
+ common.expectsError({
+ code: 'ERR_CONSOLE_WRITABLE_STREAM',
+ type: TypeError,
+ message: /stderr/
+ })
+);
out.write = err.write = (d) => {};