From 790841597d4a03428c97c8ba45ba67b46578e1f9 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 24 Mar 2020 15:17:02 -0700 Subject: [PATCH] console: fixup error message Use "options.inspectOptions" instead of just "inspectOptions" Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/32475 Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen --- lib/internal/console/constructor.js | 7 +++++-- test/parallel/test-console-instance.js | 2 +- test/parallel/test-console-tty-colors.js | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index 81c8939e90f81c..360c8acbbfd4e3 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -104,11 +104,14 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) { if (inspectOptions.colors !== undefined && options.colorMode !== undefined) { throw new ERR_INCOMPATIBLE_OPTION_PAIR( - 'inspectOptions.color', 'colorMode'); + 'options.inspectOptions.color', 'colorMode'); } optionsMap.set(this, inspectOptions); } else if (inspectOptions !== undefined) { - throw new ERR_INVALID_ARG_TYPE('inspectOptions', 'object', inspectOptions); + throw new ERR_INVALID_ARG_TYPE( + 'options.inspectOptions', + 'object', + inspectOptions); } // Bind the prototype functions to this Console instance diff --git a/test/parallel/test-console-instance.js b/test/parallel/test-console-instance.js index 19c4271d243ea7..bf22314e22e031 100644 --- a/test/parallel/test-console-instance.js +++ b/test/parallel/test-console-instance.js @@ -140,7 +140,7 @@ out.write = err.write = (d) => {}; }); }, { - message: 'The "inspectOptions" argument must be of type object.' + + message: 'The "options.inspectOptions" property must be of type object.' + common.invalidArgTypeHelper(inspectOptions), code: 'ERR_INVALID_ARG_TYPE' } diff --git a/test/parallel/test-console-tty-colors.js b/test/parallel/test-console-tty-colors.js index 41e72c3c8513bc..e906c71c186177 100644 --- a/test/parallel/test-console-tty-colors.js +++ b/test/parallel/test-console-tty-colors.js @@ -86,7 +86,7 @@ check(false, false, false); }); }, { - message: 'Option "inspectOptions.color" cannot be used in ' + + message: 'Option "options.inspectOptions.color" cannot be used in ' + 'combination with option "colorMode"', code: 'ERR_INCOMPATIBLE_OPTION_PAIR' }