Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
alicewriteswrongs committed Jul 20, 2022
1 parent 77e4235 commit de755e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/cli/parse-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ interface CLIArgValue {

/**
* Parse an 'equals' argument, which is a CLI argument-value pair in the
* format `--foobar=12` (as opposed to the space-separated format `--foobar
* 12`).
* format `--foobar=12` (as opposed to a space-separated format like
* `--foobar 12`).
*
* To parse this we split on the `=`, returning the first part as the argument
* name and the second part as the value. We join the value on `"="` in case
Expand Down
8 changes: 4 additions & 4 deletions src/cli/test/parse-flags.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,29 +190,29 @@ describe('parseFlags', () => {
it.each(STRING_CLI_ARGS)('should parse string flag %s', (cliArg) => {
const flags = parseFlags([`--${cliArg}`, 'test-value'], sys);
expect(flags.knownArgs).toEqual([`--${cliArg}`, 'test-value']);
expect(flags.unknownArgs).toEqual([])
expect(flags.unknownArgs).toEqual([]);
expect(flags[cliArg]).toBe('test-value');
});

it.each(STRING_CLI_ARGS)('should parse string flag --%s=value', (cliArg) => {
const flags = parseFlags([`--${cliArg}=path/to/file.js`], sys);
expect(flags.knownArgs).toEqual([`--${cliArg}`, 'path/to/file.js']);
expect(flags.unknownArgs).toEqual([])
expect(flags.unknownArgs).toEqual([]);
expect(flags[cliArg]).toBe('path/to/file.js');
});

it.each(NUMBER_CLI_ARGS)('should parse number flag %s', (cliArg) => {
const flags = parseFlags([`--${cliArg}`, '42'], sys);
expect(flags.knownArgs).toEqual([`--${cliArg}`, '42']);
expect(flags.unknownArgs).toEqual([])
expect(flags.unknownArgs).toEqual([]);
expect(flags[cliArg]).toBe(42);
});

it('should parse --compare', () => {
args[0] = '--compare';
const flags = parseFlags(args, sys);
expect(flags.knownArgs).toEqual(['--compare']);
expect(flags.unknownArgs).toEqual([])
expect(flags.unknownArgs).toEqual([]);
expect(flags.compare).toBe(true);
});

Expand Down

0 comments on commit de755e2

Please sign in to comment.