Skip to content

Commit 5df9cd1

Browse files
pmarchinigeeksilva97
authored andcommitted
src: enhance error messages for unknown options
PR-URL: #58677 Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent f55a9b6 commit 5df9cd1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/node_config_file.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ ParseResult ConfigReader::ParseOptions(
200200
} else {
201201
FPrintF(stderr,
202202
"Unknown or not allowed option %s for namespace %s\n",
203-
option_key.data(),
203+
option_key,
204204
namespace_name.c_str());
205205
return ParseResult::InvalidContent;
206206
}

test/parallel/test-config-file.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ test('should throw at unknown flag', async () => {
160160
fixtures.path('rc/unknown-flag.json'),
161161
'-p', '"Hello, World!"',
162162
]);
163-
match(result.stderr, /Unknown or not allowed option some-unknown-flag/);
163+
match(result.stderr, /Unknown or not allowed option some-unknown-flag for namespace nodeOptions/);
164164
strictEqual(result.stdout, '');
165165
strictEqual(result.code, 9);
166166
});
@@ -172,7 +172,7 @@ test('should throw at flag not available in NODE_OPTIONS', async () => {
172172
fixtures.path('rc/not-node-options-flag.json'),
173173
'-p', '"Hello, World!"',
174174
]);
175-
match(result.stderr, /Unknown or not allowed option test/);
175+
match(result.stderr, /Unknown or not allowed option test for namespace nodeOptions/);
176176
strictEqual(result.stdout, '');
177177
strictEqual(result.code, 9);
178178
});
@@ -411,7 +411,7 @@ describe('namespace-scoped options', () => {
411411
fixtures.path('rc/unknown-flag-namespace.json'),
412412
'-p', '"Hello, World!"',
413413
]);
414-
match(result.stderr, /Unknown or not allowed option unknown-flag/);
414+
match(result.stderr, /Unknown or not allowed option unknown-flag for namespace testRunner/);
415415
strictEqual(result.stdout, '');
416416
strictEqual(result.code, 9);
417417
});

0 commit comments

Comments
 (0)