Skip to content

src: enhance error messages for unknown options #58677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/node_config_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ ParseResult ConfigReader::ParseOptions(
} else {
FPrintF(stderr,
"Unknown or not allowed option %s for namespace %s\n",
option_key.data(),
option_key,
namespace_name.c_str());
return ParseResult::InvalidContent;
}
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-config-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ test('should throw at unknown flag', async () => {
fixtures.path('rc/unknown-flag.json'),
'-p', '"Hello, World!"',
]);
match(result.stderr, /Unknown or not allowed option some-unknown-flag/);
match(result.stderr, /Unknown or not allowed option some-unknown-flag for namespace nodeOptions/);
strictEqual(result.stdout, '');
strictEqual(result.code, 9);
});
Expand All @@ -166,7 +166,7 @@ test('should throw at flag not available in NODE_OPTIONS', async () => {
fixtures.path('rc/not-node-options-flag.json'),
'-p', '"Hello, World!"',
]);
match(result.stderr, /Unknown or not allowed option test/);
match(result.stderr, /Unknown or not allowed option test for namespace nodeOptions/);
strictEqual(result.stdout, '');
strictEqual(result.code, 9);
});
Expand Down Expand Up @@ -398,7 +398,7 @@ describe('namespace-scoped options', () => {
fixtures.path('rc/unknown-flag-namespace.json'),
'-p', '"Hello, World!"',
]);
match(result.stderr, /Unknown or not allowed option unknown-flag/);
match(result.stderr, /Unknown or not allowed option unknown-flag for namespace testRunner/);
strictEqual(result.stdout, '');
strictEqual(result.code, 9);
});
Expand Down
Loading