Skip to content

Commit c53ceb5

Browse files
committed
test: verify output of --help
1 parent 0c17616 commit c53ceb5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/cli/tests/create-tutorial.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { tmpdir } from 'node:os';
44
import path from 'node:path';
55
import { execa } from 'execa';
66
import { afterAll, beforeAll, expect, test } from 'vitest';
7+
import { version } from '../package.json';
78

89
// on CI on windows we want to make sure to use the same drive, so we use a custom logic
910
const tmpDir =
@@ -230,6 +231,23 @@ test('cannot eject on an astro project that is not using TutorialKit 2', async (
230231
).rejects.toThrow(`Could not find import to '@tutorialkit/astro'`);
231232
});
232233

234+
test('--help prints out message', async () => {
235+
const { stdout } = await execa('node', [cli, '--help']);
236+
237+
expect(stdout.replace(version, '[version]')).toMatchInlineSnapshot(`
238+
"
239+
@tutorialkit/cli v[version] Create tutorial apps powered by WebContainer API
240+
241+
Usage: @tutorialkit/cli [command] [...options]
242+
@tutorialkit/cli [ -h | --help | -v | --version ]
243+
244+
Commands:
245+
create Create new tutorial app
246+
eject Eject routes
247+
help Show this help message"
248+
`);
249+
});
250+
233251
function normaliseSlash(filePath: string) {
234252
return filePath.replace(/\\/g, '/');
235253
}

0 commit comments

Comments
 (0)