@@ -4,6 +4,7 @@ import { tmpdir } from 'node:os';
44import path from 'node:path' ;
55import { execa } from 'execa' ;
66import { 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
910const 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 Move all default pages and components into your project, providing full control over the Astro app
247+ help Show this help message"
248+ ` ) ;
249+ } ) ;
250+
233251function normaliseSlash ( filePath : string ) {
234252 return filePath . replace ( / \\ / g, '/' ) ;
235253}
0 commit comments