-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
/
index.js
58 lines (52 loc) · 1.4 KB
/
index.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* Copyright (c) 2014-present, Facebook, Inc. 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.
*
* @flow
*/
import mkdirp from 'mkdirp';
import fs from 'fs';
import BufferedConsole from './buffered_console';
import clearLine from './clear_line';
import Console from './Console';
import FakeTimers from './fake_timers';
import formatTestResults from './format_test_results';
import getConsoleOutput from './get_console_output';
import installCommonGlobals from './install_common_globals';
import NullConsole from './null_console';
import isInteractive from './is_interative';
import setGlobal from './set_global';
import validateCLIOptions from './validate_cli_options';
const createDirectory = (path: string) => {
try {
mkdirp.sync(path, '777');
} catch (e) {
if (e.code !== 'EEXIST') {
throw e;
}
}
};
const realpath = (filepath: string) => {
if (typeof fs.realpathSync.native === 'function') {
return fs.realpathSync.native(filepath);
}
// $FlowFixMe: This is need for node@<9.2
return process.binding('fs').realpath(filepath, 'utf8');
};
module.exports = {
BufferedConsole,
Console,
FakeTimers,
NullConsole,
clearLine,
createDirectory,
formatTestResults,
getConsoleOutput,
installCommonGlobals,
isInteractive,
realpath,
setGlobal,
validateCLIOptions,
};