forked from jestjs/jest
/
jest_repl.test.js
35 lines (30 loc) · 917 Bytes
/
jest_repl.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import {spawnSync} from 'child_process';
import path from 'path';
const JEST_RUNTIME = require.resolve('../../bin/jest-repl.js');
describe('Repl', () => {
describe('cli', () => {
it('runs without errors', () => {
let command = JEST_RUNTIME;
const args = [];
// Windows can't handle hashbangs, so is the best we can do
if (process.platform === 'win32') {
args.push(command);
command = 'node';
}
const output = spawnSync(command, args, {
cwd: process.cwd(),
encoding: 'utf8',
env: process.env,
});
expect(output.stderr.trim()).toBe('');
expect(output.stdout.trim()).toMatch(/›/u);
});
});
});