Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jest/console

Package Overview
Dependencies
Maintainers
6
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jest/console - npm Package Compare versions

Comparing version 29.1.2 to 29.2.0

72

build/BufferedConsole.js

@@ -7,57 +7,40 @@ 'use strict';

exports.default = void 0;
function _assert() {
const data = _interopRequireDefault(require('assert'));
const data = require('assert');
_assert = function () {
return data;
};
return data;
}
function _console() {
const data = require('console');
_console = function () {
return data;
};
return data;
}
function _util() {
const data = require('util');
_util = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**

@@ -69,2 +52,3 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

*/
class BufferedConsole extends _console().Console {

@@ -76,3 +60,2 @@ _buffer = [];

Console = _console().Console;
constructor() {

@@ -86,3 +69,2 @@ super({

}
static write(buffer, type, message, level) {

@@ -94,3 +76,3 @@ const stackLevel = level != null ? level : 2;

).stack;
invariant(rawStack, 'always have a stack trace');
invariant(rawStack != null, 'always have a stack trace');
const origin = rawStack

@@ -108,3 +90,2 @@ .split('\n')

}
_log(type, message) {

@@ -118,11 +99,13 @@ BufferedConsole.write(

}
assert(value, message) {
try {
(0, _assert().default)(value, message);
(0, _assert().strict)(value, message);
} catch (error) {
this._log('assert', error.toString());
if (!(error instanceof _assert().AssertionError)) {
throw error;
}
// https://github.com/facebook/jest/pull/13422#issuecomment-1273396392
this._log('assert', error.toString().replace(/:\n\n.*\n/gs, ''));
}
}
count(label = 'default') {

@@ -132,3 +115,2 @@ if (!this._counters[label]) {

}
this._log(

@@ -139,29 +121,21 @@ 'count',

}
countReset(label = 'default') {
this._counters[label] = 0;
}
debug(firstArg, ...rest) {
this._log('debug', (0, _util().format)(firstArg, ...rest));
}
dir(firstArg, options = {}) {
const representation = (0, _util().inspect)(firstArg, options);
this._log('dir', (0, _util().formatWithOptions)(options, representation));
}
dirxml(firstArg, ...rest) {
this._log('dirxml', (0, _util().format)(firstArg, ...rest));
}
error(firstArg, ...rest) {
this._log('error', (0, _util().format)(firstArg, ...rest));
}
group(title, ...rest) {
this._groupDepth++;
if (title || rest.length > 0) {
if (title != null || rest.length > 0) {
this._log(

@@ -173,7 +147,5 @@ 'group',

}
groupCollapsed(title, ...rest) {
this._groupDepth++;
if (title || rest.length > 0) {
if (title != null || rest.length > 0) {
this._log(

@@ -185,3 +157,2 @@ 'groupCollapsed',

}
groupEnd() {

@@ -192,26 +163,19 @@ if (this._groupDepth > 0) {

}
info(firstArg, ...rest) {
this._log('info', (0, _util().format)(firstArg, ...rest));
}
log(firstArg, ...rest) {
this._log('log', (0, _util().format)(firstArg, ...rest));
}
time(label = 'default') {
if (this._timers[label]) {
if (this._timers[label] != null) {
return;
}
this._timers[label] = new Date();
}
timeEnd(label = 'default') {
const startTime = this._timers[label];
if (startTime) {
if (startTime != null) {
const endTime = new Date();
const time = endTime.getTime() - startTime.getTime();
this._log(

@@ -221,14 +185,10 @@ 'time',

);
delete this._timers[label];
}
}
timeLog(label = 'default', ...data) {
const startTime = this._timers[label];
if (startTime) {
if (startTime != null) {
const endTime = new Date();
const time = endTime.getTime() - startTime.getTime();
this._log(

@@ -243,7 +203,5 @@ 'time',

}
warn(firstArg, ...rest) {
this._log('warn', (0, _util().format)(firstArg, ...rest));
}
getBuffer() {

@@ -253,5 +211,3 @@ return this._buffer.length ? this._buffer : undefined;

}
exports.default = BufferedConsole;
function invariant(condition, message) {

@@ -258,0 +214,0 @@ if (!condition) {

@@ -7,57 +7,40 @@ 'use strict';

exports.default = void 0;
function _assert() {
const data = _interopRequireDefault(require('assert'));
const data = require('assert');
_assert = function () {
return data;
};
return data;
}
function _console() {
const data = require('console');
_console = function () {
return data;
};
return data;
}
function _util() {
const data = require('util');
_util = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**

@@ -69,2 +52,3 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

*/
class CustomConsole extends _console().Console {

@@ -78,3 +62,2 @@ _stdout;

Console = _console().Console;
constructor(stdout, stderr, formatBuffer = (_type, message) => message) {

@@ -86,3 +69,2 @@ super(stdout, stderr);

}
_log(type, message) {

@@ -94,3 +76,2 @@ (0, _jestUtil().clearLine)(this._stdout);

}
_logError(type, message) {

@@ -102,11 +83,13 @@ (0, _jestUtil().clearLine)(this._stderr);

}
assert(value, message) {
try {
(0, _assert().default)(value, message);
(0, _assert().strict)(value, message);
} catch (error) {
this._logError('assert', error.toString());
if (!(error instanceof _assert().AssertionError)) {
throw error;
}
// https://github.com/facebook/jest/pull/13422#issuecomment-1273396392
this._logError('assert', error.toString().replace(/:\n\n.*\n/gs, ''));
}
}
count(label = 'default') {

@@ -116,3 +99,2 @@ if (!this._counters[label]) {

}
this._log(

@@ -123,29 +105,21 @@ 'count',

}
countReset(label = 'default') {
this._counters[label] = 0;
}
debug(firstArg, ...args) {
this._log('debug', (0, _util().format)(firstArg, ...args));
}
dir(firstArg, options = {}) {
const representation = (0, _util().inspect)(firstArg, options);
this._log('dir', (0, _util().formatWithOptions)(options, representation));
}
dirxml(firstArg, ...args) {
this._log('dirxml', (0, _util().format)(firstArg, ...args));
}
error(firstArg, ...args) {
this._logError('error', (0, _util().format)(firstArg, ...args));
}
group(title, ...args) {
this._groupDepth++;
if (title || args.length > 0) {
if (title != null || args.length > 0) {
this._log(

@@ -157,7 +131,5 @@ 'group',

}
groupCollapsed(title, ...args) {
this._groupDepth++;
if (title || args.length > 0) {
if (title != null || args.length > 0) {
this._log(

@@ -169,3 +141,2 @@ 'groupCollapsed',

}
groupEnd() {

@@ -176,26 +147,19 @@ if (this._groupDepth > 0) {

}
info(firstArg, ...args) {
this._log('info', (0, _util().format)(firstArg, ...args));
}
log(firstArg, ...args) {
this._log('log', (0, _util().format)(firstArg, ...args));
}
time(label = 'default') {
if (this._timers[label]) {
if (this._timers[label] != null) {
return;
}
this._timers[label] = new Date();
}
timeEnd(label = 'default') {
const startTime = this._timers[label];
if (startTime) {
if (startTime != null) {
const endTime = new Date().getTime();
const time = endTime - startTime.getTime();
this._log(

@@ -205,14 +169,10 @@ 'time',

);
delete this._timers[label];
}
}
timeLog(label = 'default', ...data) {
const startTime = this._timers[label];
if (startTime) {
if (startTime != null) {
const endTime = new Date();
const time = endTime.getTime() - startTime.getTime();
this._log(

@@ -227,7 +187,5 @@ 'time',

}
warn(firstArg, ...args) {
this._logError('warn', (0, _util().format)(firstArg, ...args));
}
getBuffer() {

@@ -237,3 +195,2 @@ return undefined;

}
exports.default = CustomConsole;

14

build/getConsoleOutput.js

@@ -7,27 +7,19 @@ 'use strict';

exports.default = getConsoleOutput;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _jestMessageUtil() {
const data = require('jest-message-util');
_jestMessageUtil = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**

@@ -39,4 +31,6 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

*/
function getConsoleOutput(buffer, config, globalConfig) {
const TITLE_INDENT = globalConfig.verbose ? ' '.repeat(2) : ' '.repeat(4);
const TITLE_INDENT =
globalConfig.verbose === true ? ' '.repeat(2) : ' '.repeat(4);
const CONSOLE_INDENT = TITLE_INDENT + ' '.repeat(2);

@@ -51,3 +45,2 @@ const logEntries = buffer.reduce((output, {type, message, origin}) => {

let noCodeFrame = true;
if (type === 'warn') {

@@ -64,3 +57,2 @@ message = _chalk().default.yellow(message);

}
const options = {

@@ -67,0 +59,0 @@ noCodeFrame,

@@ -15,3 +15,3 @@ /**

export declare class BufferedConsole extends Console_2 {
private _buffer;
private readonly _buffer;
private _counters;

@@ -23,2 +23,3 @@ private _timers;

static write(
this: void,
buffer: ConsoleBuffer,

@@ -52,5 +53,5 @@ type: LogType,

export declare class CustomConsole extends Console_2 {
private _stdout;
private _stderr;
private _formatBuffer;
private readonly _stdout;
private readonly _stderr;
private readonly _formatBuffer;
private _counters;

@@ -57,0 +58,0 @@ private _timers;

@@ -30,13 +30,8 @@ 'use strict';

});
var _BufferedConsole = _interopRequireDefault(require('./BufferedConsole'));
var _CustomConsole = _interopRequireDefault(require('./CustomConsole'));
var _NullConsole = _interopRequireDefault(require('./NullConsole'));
var _getConsoleOutput = _interopRequireDefault(require('./getConsoleOutput'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}

@@ -7,11 +7,7 @@ 'use strict';

exports.default = void 0;
var _CustomConsole = _interopRequireDefault(require('./CustomConsole'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/* eslint-disable @typescript-eslint/no-empty-function */
/**

@@ -23,32 +19,19 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

*/
class NullConsole extends _CustomConsole.default {
assert() {}
debug() {}
dir() {}
error() {}
info() {}
log() {}
time() {}
timeEnd() {}
timeLog() {}
trace() {}
warn() {}
group() {}
groupCollapsed() {}
groupEnd() {}
}
exports.default = NullConsole;
{
"name": "@jest/console",
"version": "29.1.2",
"version": "29.2.0",
"repository": {

@@ -20,11 +20,11 @@ "type": "git",

"dependencies": {
"@jest/types": "^29.1.2",
"@jest/types": "^29.2.0",
"@types/node": "*",
"chalk": "^4.0.0",
"jest-message-util": "^29.1.2",
"jest-util": "^29.1.2",
"jest-message-util": "^29.2.0",
"jest-util": "^29.2.0",
"slash": "^3.0.0"
},
"devDependencies": {
"@jest/test-utils": "^29.1.2"
"@jest/test-utils": "^29.2.0"
},

@@ -37,3 +37,3 @@ "engines": {

},
"gitHead": "3c31dd619e8c022cde53f40fa12ea2a67f4752ce"
"gitHead": "ee5b37a4f4433afcfffb0356cea47739d8092287"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc