Skip to content

Commit

Permalink
Add test for PR tj#1062
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn committed Sep 29, 2019
1 parent fd54342 commit 03b0034
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions tests/openIssues.test.js.skip
Expand Up @@ -4,7 +4,7 @@ const path = require('path');

describe('open issues', () => {
// https://github.com/tj/commander.js/issues/1039
test('#1039: when unknown option then unknown option detected', () => {
test.skip('#1039: when unknown option then unknown option detected', () => {
const program = new commander.Command();
program
.exitOverride();
Expand All @@ -13,7 +13,7 @@ describe('open issues', () => {
}).toThrow();
});

test('#1039: when unknown option and multiple arguments then unknown option detected', () => {
test.skip('#1039: when unknown option and multiple arguments then unknown option detected', () => {
const program = new commander.Command();
program
.exitOverride();
Expand All @@ -33,20 +33,20 @@ describe('open issues', () => {
return program;
};

test('#1032: when specify subcommand then args not empty', () => {
test.skip('#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', () => {
test.skip('#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);
});

// https://github.com/tj/commander.js/issues/561
test('#561: when specify argument and unknown option then error', () => {
test.skip('#561: when specify argument and unknown option then error', () => {
const program = new commander.Command();
program
.exitOverride()
Expand All @@ -59,11 +59,26 @@ describe('open issues', () => {
});

// https://github.com/tj/commander.js/issues/508
test('#508: when arguments to executable include option flags then argument order preserved', (done) => {
test.skip('#508: when arguments to executable include option flags then argument order preserved', (done) => {
const pm = path.join(__dirname, 'fixtures/pm');
childProcess.execFile('node', [pm, 'echo', '1', '2', '--dry-run', '3', '4', '5', '6'], function(_error, stdout, stderr) {
expect(stdout).toBe("[ '1', '2', '--dry-run', '3', '4', '5', '6' ]\n");
done();
});
});

// https://github.com/tj/commander.js/pull/1062
test.skip('#1062 when .action on program with subcommands and no program argument then program action called', () => {
const actionMock = jest.fn();
const program = new commander.Command();
program
.arguments('[file]')
.action(actionMock);
program
.command('subcommand');

program.parse(['node', 'test']);

expect(actionMock).toHaveBeenCalledWith(undefined, program);
});
});

0 comments on commit 03b0034

Please sign in to comment.