Skip to content

Commit

Permalink
Merge pull request #25111 from qmonmert/commander1200
Browse files Browse the repository at this point in the history
Commander 12.0.0
  • Loading branch information
DanielFran authored Feb 10, 2024
2 parents 69265fa + 3b01695 commit ac763b9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
30 changes: 15 additions & 15 deletions cli/cli.spec.mts
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,16 @@ describe('cli', () => {
description: 'Foo',
},
{
option: '--no-foo',
description: 'No foo',
option: '--qux-cd',
description: 'Qux cd',
},
{
option: '--foo-bar',
description: 'Foo bar',
option: '--bar',
description: 'Bar',
},
{
option: '--no-foo-bar',
description: 'No foo bar',
option: '--xyz-ab',
description: 'Xyz ab',
},
],
};
Expand All @@ -293,7 +293,7 @@ describe('cli', () => {
commands.mocked.desc = 'Mocked command';
commands.mocked.argument = ['<name>'];
commands.mocked.cliOnly = true;
argv = ['jhipster', 'jhipster', 'mocked', 'Foo', '--foo', '--foo-bar'];
argv = ['jhipster', 'jhipster', 'mocked', 'Foo', '--foo', '--bar'];
});

commonTests();
Expand All @@ -302,7 +302,7 @@ describe('cli', () => {
const cb = (args, options) => {
expect(args).toEqual(['Foo']);
expect(options.foo).toBe(true);
expect(options.fooBar).toBe(true);
expect(options.bar).toBe(true);
};
await mockCli(argv, { commands, './mocked': cb });
});
Expand All @@ -313,16 +313,16 @@ describe('cli', () => {
commands.mocked.desc = 'Mocked command';
commands.mocked.argument = ['<name>'];
commands.mocked.cliOnly = true;
argv = ['jhipster', 'jhipster', 'mocked', 'Foo', '--no-foo', '--no-foo-bar'];
argv = ['jhipster', 'jhipster', 'mocked', 'Foo', '--qux-cd', '--xyz-ab'];
});

commonTests();

it('should forward argument and options', async () => {
const cb = (args, options) => {
expect(args).toEqual(['Foo']);
expect(options.foo).toBe(false);
expect(options.fooBar).toBe(false);
expect(options.foo).toBeUndefined();
expect(options.bar).toBeUndefined();
};
await mockCli(argv, { commands, './mocked': cb });
});
Expand All @@ -333,7 +333,7 @@ describe('cli', () => {
commands.mocked.desc = 'Mocked command';
commands.mocked.argument = ['<name...>'];
commands.mocked.cliOnly = true;
argv = ['jhipster', 'jhipster', 'mocked', 'Foo', 'Bar', '--foo', '--foo-bar'];
argv = ['jhipster', 'jhipster', 'mocked', 'Foo', 'Bar', '--foo', '--bar'];
});

commonTests();
Expand All @@ -342,7 +342,7 @@ describe('cli', () => {
const cb = (args, options) => {
expect(args).toEqual([['Foo', 'Bar']]);
expect(options.foo).toBe(true);
expect(options.fooBar).toBe(true);
expect(options.bar).toBe(true);
};
await mockCli(argv, { commands, './mocked': cb });
});
Expand All @@ -352,7 +352,7 @@ describe('cli', () => {
beforeEach(() => {
commands.mocked.desc = 'Mocked command';
commands.mocked.cliOnly = true;
argv = ['jhipster', 'jhipster', 'mocked', '--foo', '--foo-bar'];
argv = ['jhipster', 'jhipster', 'mocked', '--foo', '--bar'];
});

commonTests();
Expand All @@ -361,7 +361,7 @@ describe('cli', () => {
const cb = (args, options) => {
expect(args).toEqual([]);
expect(options.foo).toBe(true);
expect(options.fooBar).toBe(true);
expect(options.bar).toBe(true);
};
return mockCli(argv, { commands, './mocked': cb });
});
Expand Down
18 changes: 13 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"axios": "1.6.7",
"chalk": "5.3.0",
"chevrotain": "11.0.3",
"commander": "11.1.0",
"commander": "12.0.0",
"conf": "12.0.0",
"debug": "4.3.4",
"didyoumean": "1.2.2",
Expand Down

0 comments on commit ac763b9

Please sign in to comment.