Add test for PR #1062
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by John Gee · committed by John Gee · parent fd54342 · Browse files · 1 file·+21 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+21 added−6 removed
- tests:+21 added−6 removed
Provenance
- Commit
03b0034- Tree
5be5d70- Author
John Gee <john@ruru.gen.nz>- Committer
John Gee <john@ruru.gen.nz>- Parent
fd54342
1 file changed+21 added−6 removed
modified:tests/openIssues.test.js.skip+21 added-6 removed
2 unmodified lines3 const path = require('path');4 5 describe('open issues', () => {6 // https://github.com/tj/commander.js/issues/10397- test('#1039: when unknown option then unknown option detected', () => {7+ test.skip('#1039: when unknown option then unknown option detected', () => {8 const program = new commander.Command();9 program10 .exitOverride();11 expect(() => {12 program.parse(['node', 'text', '--bug']);13 }).toThrow();14 });15 16- test('#1039: when unknown option and multiple arguments then unknown option detected', () => {16+ test.skip('#1039: when unknown option and multiple arguments then unknown option detected', () => {17 const program = new commander.Command();18 program19 .exitOverride();20 expect(() => {11 unmodified lines32 });33 return program;34 };35 36- test('#1032: when specify subcommand then args not empty', () => {36+ test.skip('#1032: when specify subcommand then args not empty', () => {37 const program = createProgram1032();38 program.parse(['node', 'test.js', 'doit', 'myid']);39 expect(program.args.length).toBeGreaterThan(0);40 });41 42- test('#1032: when specify subcommand and option then args not empty', () => {42+ test.skip('#1032: when specify subcommand and option then args not empty', () => {43 const program = createProgram1032();44 program.parse(['node', 'test.js', 'doit', '--better', 'myid']);45 expect(program.args.length).toBeGreaterThan(0);46 });47 48 // https://github.com/tj/commander.js/issues/56149- test('#561: when specify argument and unknown option then error', () => {49+ test.skip('#561: when specify argument and unknown option then error', () => {50 const program = new commander.Command();51 program52 .exitOverride()53 .option('-x, --x-flag', 'A flag')4 unmodified lines58 }).toThrow();59 });60 61 // https://github.com/tj/commander.js/issues/50862- test('#508: when arguments to executable include option flags then argument order preserved', (done) => {62+ test.skip('#508: when arguments to executable include option flags then argument order preserved', (done) => {63 const pm = path.join(__dirname, 'fixtures/pm');64 childProcess.execFile('node', [pm, 'echo', '1', '2', '--dry-run', '3', '4', '5', '6'], function(_error, stdout, stderr) {65 expect(stdout).toBe("[ '1', '2', '--dry-run', '3', '4', '5', '6' ]\n");66 done();67 });68 });69+70+ // https://github.com/tj/commander.js/pull/106271+ test.skip('#1062 when .action on program with subcommands and no program argument then program action called', () => {72+ const actionMock = jest.fn();73+ const program = new commander.Command();74+ program75+ .arguments('[file]')76+ .action(actionMock);77+ program78+ .command('subcommand');79+80+ program.parse(['node', 'test']);81+82+ expect(actionMock).toHaveBeenCalledWith(undefined, program);83+ });84 });