1/* eslint-env jest */
2import fs from 'fs/promises';
3
4import { execute, projectRoot } from './utils';
5
6const originalForceColor = process.env.FORCE_COLOR;
7beforeAll(async () => {
8  await fs.mkdir(projectRoot, { recursive: true });
9  process.env.FORCE_COLOR = '0';
10});
11afterAll(() => {
12  process.env.FORCE_COLOR = originalForceColor;
13});
14
15it('runs `npx expo --version`', async () => {
16  const results = await execute('--version');
17  expect(results.stdout).toEqual(require('../../package.json').version);
18});
19it('runs `npx expo -v`', async () => {
20  const results = await execute('-v');
21  expect(results.stdout).toEqual(require('../../package.json').version);
22});
23
24it('runs `npx expo --help`', async () => {
25  const results = await execute('--help');
26  expect(results.stdout).toMatchInlineSnapshot(`
27    "
28      Usage
29        $ npx expo <command>
30
31      Commands
32        start, export, export:web
33        run:ios, run:android, prebuild
34        install, customize, config
35        login, logout, whoami, register
36
37      Options
38        --version, -v   Version number
39        --help, -h      Usage info
40
41      For more info run a command with the --help flag
42        $ npx expo start --help
43    "
44  `);
45});
46