diff --git a/src/interfaces/parser.ts b/src/interfaces/parser.ts index 7d663573..ea111027 100644 --- a/src/interfaces/parser.ts +++ b/src/interfaces/parser.ts @@ -118,7 +118,7 @@ export type FlagProps = { /** * Accept an environment variable as input */ - env?: string; + env?: string; /** * If true, the flag will not be shown in the help. */ @@ -142,7 +142,7 @@ export type FlagProps = { /** * Define complex relationships between flags. */ - relationships?: Relationship[]; + relationships?: Relationship[]; } export type BooleanFlagProps = FlagProps & { diff --git a/src/parser/parse.ts b/src/parser/parse.ts index a7d965e2..bee68e18 100644 --- a/src/parser/parse.ts +++ b/src/parser/parse.ts @@ -258,7 +258,7 @@ export class Parser { expect(out.args).to.deep.equal({foo: 'arg1', bar: 'arg2'}) }) + it('should throw if unexpected argument is provided', async () => { + try { + await parse(['arg1'], {}) + expect.fail('should have thrown') + } catch (error) { + const err = error as CLIError + expect(err.message).to.include('Unexpected argument: arg1') + } + }) + describe('output: array', () => { it('--bool', async () => { const out = await parse(['--bool'], {