diff --git a/packages/rstack/src/fmt/cli.ts b/packages/rstack/src/fmt/cli.ts index 480acb8..ab56529 100644 --- a/packages/rstack/src/fmt/cli.ts +++ b/packages/rstack/src/fmt/cli.ts @@ -26,13 +26,13 @@ ${color.yellow(' $ rs fmt [options] [files/globs...]')} Format files with Prettier. ${color.cyan('Options')}: - --write Write formatted files in place (default) - --check Check whether files are formatted - --list-different Print paths of unformatted files - --ignore-path Path to an additional ignore file (repeatable) + --write Write formatted files in place (default) + --check Check whether files are formatted + --list-different Print paths of unformatted files + --ignore-path Path to an additional ignore file (repeatable) --parallel-workers Number of parallel workers - --stdin-filepath Format stdin as if it were saved at - -h, --help Display this help message`; + --stdin-filepath Format stdin as if it were saved at + -h, --help Display this help message`; const parseMaxWorkers = ( kebabValue: string | undefined, diff --git a/packages/rstack/tests/fmt/__snapshots__/cli.test.ts.snap b/packages/rstack/tests/fmt/__snapshots__/cli.test.ts.snap new file mode 100644 index 0000000..b22c256 --- /dev/null +++ b/packages/rstack/tests/fmt/__snapshots__/cli.test.ts.snap @@ -0,0 +1,17 @@ +// Rstest Snapshot v1 + +exports[`provides command help 1`] = ` +"Usage: + $ rs fmt [options] [files/globs...] + +Format files with Prettier. + +Options: + --write Write formatted files in place (default) + --check Check whether files are formatted + --list-different Print paths of unformatted files + --ignore-path Path to an additional ignore file (repeatable) + --parallel-workers Number of parallel workers + --stdin-filepath Format stdin as if it were saved at + -h, --help Display this help message" +`; diff --git a/packages/rstack/tests/fmt/cli.test.ts b/packages/rstack/tests/fmt/cli.test.ts index bc97edb..61cf2f4 100644 --- a/packages/rstack/tests/fmt/cli.test.ts +++ b/packages/rstack/tests/fmt/cli.test.ts @@ -139,14 +139,10 @@ test('rejects file arguments with --stdin-filepath', () => { }); test('provides command help', () => { - expect(fmtHelpMessage).toContain('Usage:\n $ rs fmt [options] [files/globs...]'); - expect(fmtHelpMessage).toContain('--write'); - expect(fmtHelpMessage).toContain('--check'); - expect(fmtHelpMessage).toContain('--list-different'); - expect(fmtHelpMessage).toContain('--ignore-path '); - expect(fmtHelpMessage).toContain('--parallel-workers '); - expect(fmtHelpMessage).toContain('--stdin-filepath '); - expect(fmtHelpMessage).toContain('-h, --help'); + const helpMessage = stripVTControlCharacters(fmtHelpMessage).replace(/^Rstack v.*\n\n/, ''); + + expect(helpMessage).toContain('Usage:\n $ rs fmt [options] [files/globs...]'); + expect(helpMessage).toMatchSnapshot(); }); test.each([