Skip to content

Commit

Permalink
Add test showing tj#1032
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn committed Sep 9, 2019
1 parent 2533d05 commit 100713d
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion tests-jest/openIssues.test.js
@@ -1,6 +1,7 @@
const commander = require('../');

describe.skip('open issues', () => {
describe('open issues', () => {
// https://github.com/tj/commander.js/issues/1039
test('#1039: when unknown option then unknown option detected', () => {
const program = new commander.Command();
program
Expand All @@ -18,4 +19,27 @@ describe.skip('open issues', () => {
program.parse(['node', 'text', '--bug', '0', '1', '2', '3']);
}).toThrow();
});

// https://github.com/tj/commander.js/issues/1032
function createProgram1032() {
const program = new commander.Command();
program
.command('doit [id]')
.option('--better', 'do it better')
.action((id, cmd) => {
});
return program;
};

test('#1032: when specify subcommand then args not empty', () => {
const program = createProgram1032();
program.parse(['node', 'test.js', 'doit', 'myid']);
expect(program.args.length).toBeGreaterThan(0);
});

test('#1032: when specify subcommand and option then args not empty', () => {
const program = createProgram1032();
program.parse(['node', 'test.js', 'doit', '--better', 'myid']);
expect(program.args.length).toBeGreaterThan(0);
});
});

0 comments on commit 100713d

Please sign in to comment.