UNPKG

1.75 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', {
4 value: true
5});
6exports.default = void 0;
7
8function _chalk() {
9 const data = _interopRequireDefault(require('chalk'));
10
11 _chalk = function () {
12 return data;
13 };
14
15 return data;
16}
17
18function _jestWatcher() {
19 const data = require('jest-watcher');
20
21 _jestWatcher = function () {
22 return data;
23 };
24
25 return data;
26}
27
28function _interopRequireDefault(obj) {
29 return obj && obj.__esModule ? obj : {default: obj};
30}
31
32/**
33 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
34 *
35 * This source code is licensed under the MIT license found in the
36 * LICENSE file in the root directory of this source tree.
37 */
38var _default = (pipe, stdin = process.stdin) =>
39 new Promise((resolve, reject) => {
40 if (typeof stdin.setRawMode === 'function') {
41 const messages = [
42 _chalk().default.red('There are deprecation warnings.\n'),
43 _chalk().default.dim(' \u203A Press ') +
44 'Enter' +
45 _chalk().default.dim(' to continue.'),
46 _chalk().default.dim(' \u203A Press ') +
47 'Esc' +
48 _chalk().default.dim(' to exit.')
49 ];
50 pipe.write(messages.join('\n'));
51 stdin.setRawMode(true);
52 stdin.resume();
53 stdin.setEncoding('utf8'); // this is a string since we set encoding above
54
55 stdin.on('data', key => {
56 if (key === _jestWatcher().KEYS.ENTER) {
57 resolve();
58 } else if (
59 [
60 _jestWatcher().KEYS.ESCAPE,
61 _jestWatcher().KEYS.CONTROL_C,
62 _jestWatcher().KEYS.CONTROL_D
63 ].indexOf(key) !== -1
64 ) {
65 reject();
66 }
67 });
68 } else {
69 resolve();
70 }
71 });
72
73exports.default = _default;