Skip to content

Commit 3b42537

Browse files
committed
Add obscure edge case for coverage
1 parent f2f2be0 commit 3b42537

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/options.bool.test.js

+10
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ describe('boolean flag with non-boolean default', () => {
106106
program.parse(['node', 'test', '--olives']);
107107
expect(program.opts().olives).toBe(flagValue);
108108
});
109+
110+
test('when flag implied and negated then value is false', () => {
111+
const flagValue = 'black';
112+
const program = new commander.Command();
113+
program
114+
.option('-v, --olives', 'Add olives? Sorry we only have black.', flagValue)
115+
.option('--no-olives');
116+
program.parse(['node', 'test', '--olives', '--no-olives']);
117+
expect(program.opts().olives).toBe(false);
118+
});
109119
});
110120

111121
// Regression test for #1301 with `-no-` in middle of option

0 commit comments

Comments
 (0)