Skip to content

Commit dfb0144

Browse files
pmarchinitargos
authored andcommitted
src: enhance error messages for unknown options
PR-URL: #58677 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent ec808b3 commit dfb0144

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
@@ -154,7 +154,7 @@ test('should throw at unknown flag', async () => {
154154
fixtures.path('rc/unknown-flag.json'),
155155
'-p', '"Hello, World!"',
156156
]);
157-
match(result.stderr, /Unknown or not allowed option some-unknown-flag/);
157+
match(result.stderr, /Unknown or not allowed option some-unknown-flag for namespace nodeOptions/);
158158
strictEqual(result.stdout, '');
159159
strictEqual(result.code, 9);
160160
});
@@ -166,7 +166,7 @@ test('should throw at flag not available in NODE_OPTIONS', async () => {
166166
fixtures.path('rc/not-node-options-flag.json'),
167167
'-p', '"Hello, World!"',
168168
]);
169-
match(result.stderr, /Unknown or not allowed option test/);
169+
match(result.stderr, /Unknown or not allowed option test for namespace nodeOptions/);
170170
strictEqual(result.stdout, '');
171171
strictEqual(result.code, 9);
172172
});
@@ -401,7 +401,7 @@ describe('namespace-scoped options', () => {
401401
fixtures.path('rc/unknown-flag-namespace.json'),
402402
'-p', '"Hello, World!"',
403403
]);
404-
match(result.stderr, /Unknown or not allowed option unknown-flag/);
404+
match(result.stderr, /Unknown or not allowed option unknown-flag for namespace testRunner/);
405405
strictEqual(result.stdout, '');
406406
strictEqual(result.code, 9);
407407
});

0 commit comments

Comments
 (0)