Skip to content

Commit 97b9180

Browse files
authored
test: add test for short-option followed by its value
PR-URL: #43358 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 5114c46 commit 97b9180

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/parallel/test-parse-args.mjs

+8
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ test('handles short-option groups with "short" alias configured', () => {
9191
assert.deepStrictEqual(result, expected);
9292
});
9393

94+
test('handles short-option followed by its value', () => {
95+
const args = ['-fFILE'];
96+
const options = { foo: { short: 'f', type: 'string' } };
97+
const expected = { values: { __proto__: null, foo: 'FILE' }, positionals: [] };
98+
const result = parseArgs({ strict: false, args, options });
99+
assert.deepStrictEqual(result, expected);
100+
});
101+
94102
test('Everything after a bare `--` is considered a positional argument', () => {
95103
const args = ['--', 'barepositionals', 'mopositionals'];
96104
const expected = { values: { __proto__: null }, positionals: ['barepositionals', 'mopositionals'] };

0 commit comments

Comments
 (0)