Skip to content
Myr

Add tests for illegal passThroughOptions

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Wee Bit · committed by Abe Tomoaki · parent 681a7e4 · Browse files · 1 file+29 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+29 added−6 removed

  • tests:+29 added−6 removed

1 file+29 added−6 removed

modified:tests/command.positionalOptions.test.js+29 added-6 removed
360 unmodified lines
361});362363// ------------------------------------------------------------------------------364365describe('illegal passThroughOptions', () => {365test('when program not positional and turn on passthrough in subcommand then error', () => {366 const program = new commander.Command();367 const sub = program.command('sub');366 test('when program not positional and turn on passThroughOptions in subcommand then error', () => {367 const program = new commander.Command();368 const sub = program.command('sub');369369 expect(() => {370 sub.passThroughOptions();371 }).toThrow();370 expect(() => {371 sub.passThroughOptions();372 }).toThrow();373 });374375 test('when program not positional and add subcommand with passThroughOptions then error', () => {376 const program = new commander.Command();377 const sub = new commander.Command('sub')378 .passThroughOptions();379380 expect(() => {381 program.addCommand(sub);382 }).toThrow();383 });384385 test('when program has subcommand with passThroughOptions and reset to non-positional then error', () => {386 const program = new commander.Command()387 .enablePositionalOptions();388 program.command('sub')389 .passThroughOptions();390391 expect(() => {392 program.enablePositionalOptions(false);393 }).toThrow();394 });395});396397// ------------------------------------------------------------------------------398
140 unmodified lines