Skip to content
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
4 changes: 2 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ if (options.nodeVersion) {
}

(async () => {
if (options.printConfig) {
if (input.length > 0) {
if (typeof options.printConfig === 'string') {
if (input.length > 0 || options.printConfig === '') {
console.error('The `--print-config` flag must be used with exactly one filename');
process.exit(1);
}
Expand Down
7 changes: 7 additions & 0 deletions test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,10 @@ test('print-config flag requires a single filename', async t => {
);
t.is(error.stderr.trim(), 'The `--print-config` flag must be used with exactly one filename');
});

test('print-config flag without filename', async t => {
const error = await t.throwsAsync(() =>
main(['--print-config']),
);
t.is(error.stderr.trim(), 'The `--print-config` flag must be used with exactly one filename');
});