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        Available commands
32          config, install, login, logout, prebuild, register, start, whoami
33
34        Options
35          --version, -v   Version number
36          --help, -h      Displays this message
37
38        For more information run a command with the --help flag
39          $ expo start --help
40      "
41  `);
42});
43