Skip to content

Commit

Permalink
Add regression test for tj#1301
Browse files Browse the repository at this point in the history
Co-author: snitin315@gmail.com
  • Loading branch information
shadowspawn committed Jul 18, 2020
1 parent 3c85087 commit 03f0fc1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/options.bool.test.js
Expand Up @@ -107,3 +107,22 @@ describe('boolean flag with non-boolean default', () => {
expect(program.olives).toBe(flagValue);
});
});

// Regression test for #1301 with `-no-` in middle of option
describe('regression test for -no- in middle of option flag', () => {
test('when flag not specified then value is undefined', () => {
const program = new commander.Command();
program
.option('--module-no-parse');
program.parse(['node', 'test']);
expect(program.moduleNoParse).toBeUndefined();
});

test('when flag specified then value is true', () => {
const program = new commander.Command();
program
.option('--module-no-parse');
program.parse(['node', 'test', '--module-no-parse']);
expect(program.moduleNoParse).toEqual(true);
});
});

0 comments on commit 03f0fc1

Please sign in to comment.