Updating NPM dependencies
This commit is contained in:
80
node_modules/@jest/console/build/CustomConsole.js
generated
vendored
80
node_modules/@jest/console/build/CustomConsole.js
generated
vendored
@@ -8,17 +8,7 @@ exports.default = void 0;
|
||||
function _assert() {
|
||||
const data = _interopRequireDefault(require('assert'));
|
||||
|
||||
_assert = function _assert() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _util() {
|
||||
const data = require('util');
|
||||
|
||||
_util = function _util() {
|
||||
_assert = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -28,7 +18,17 @@ function _util() {
|
||||
function _console() {
|
||||
const data = require('console');
|
||||
|
||||
_console = function _console() {
|
||||
_console = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _util() {
|
||||
const data = require('util');
|
||||
|
||||
_util = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -38,7 +38,17 @@ function _console() {
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
|
||||
_chalk = function _chalk() {
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -63,13 +73,6 @@ function _defineProperty(obj, key, value) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
// TODO: Copied from `jest-util`. Import from it in Jest 25
|
||||
function clearLine(stream) {
|
||||
if (stream.isTTY) {
|
||||
stream.write('\x1b[999D\x1b[K');
|
||||
}
|
||||
}
|
||||
|
||||
class CustomConsole extends _console().Console {
|
||||
constructor(stdout, stderr, formatBuffer = (_type, message) => message) {
|
||||
super(stdout, stderr);
|
||||
@@ -80,29 +83,28 @@ class CustomConsole extends _console().Console {
|
||||
|
||||
_defineProperty(this, '_formatBuffer', void 0);
|
||||
|
||||
_defineProperty(this, '_counters', void 0);
|
||||
_defineProperty(this, '_counters', {});
|
||||
|
||||
_defineProperty(this, '_timers', void 0);
|
||||
_defineProperty(this, '_timers', {});
|
||||
|
||||
_defineProperty(this, '_groupDepth', void 0);
|
||||
_defineProperty(this, '_groupDepth', 0);
|
||||
|
||||
_defineProperty(this, 'Console', _console().Console);
|
||||
|
||||
this._stdout = stdout;
|
||||
this._stderr = stderr;
|
||||
this._formatBuffer = formatBuffer;
|
||||
this._counters = {};
|
||||
this._timers = {};
|
||||
this._groupDepth = 0;
|
||||
}
|
||||
|
||||
_log(type, message) {
|
||||
clearLine(this._stdout);
|
||||
(0, _jestUtil().clearLine)(this._stdout);
|
||||
super.log(
|
||||
this._formatBuffer(type, ' '.repeat(this._groupDepth) + message)
|
||||
);
|
||||
}
|
||||
|
||||
_logError(type, message) {
|
||||
clearLine(this._stderr);
|
||||
(0, _jestUtil().clearLine)(this._stderr);
|
||||
super.error(
|
||||
this._formatBuffer(type, ' '.repeat(this._groupDepth) + message)
|
||||
);
|
||||
@@ -198,12 +200,32 @@ class CustomConsole extends _console().Console {
|
||||
const endTime = new Date().getTime();
|
||||
const time = endTime - startTime.getTime();
|
||||
|
||||
this._log('time', (0, _util().format)(`${label}: ${time}ms`));
|
||||
this._log(
|
||||
'time',
|
||||
(0, _util().format)(`${label}: ${(0, _jestUtil().formatTime)(time)}`)
|
||||
);
|
||||
|
||||
delete this._timers[label];
|
||||
}
|
||||
}
|
||||
|
||||
timeLog(label = 'default', ...data) {
|
||||
const startTime = this._timers[label];
|
||||
|
||||
if (startTime) {
|
||||
const endTime = new Date();
|
||||
const time = endTime.getTime() - startTime.getTime();
|
||||
|
||||
this._log(
|
||||
'time',
|
||||
(0, _util().format)(
|
||||
`${label}: ${(0, _jestUtil().formatTime)(time)}`,
|
||||
...data
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
warn(firstArg, ...args) {
|
||||
this._logError('warn', (0, _util().format)(firstArg, ...args));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user