Socket
Socket
Sign inDemoInstall

@jest/reporters

Package Overview
Dependencies
Maintainers
6
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jest/reporters - npm Package Compare versions

Comparing version 29.1.2 to 29.2.0

19

build/BaseReporter.js

@@ -7,13 +7,9 @@ 'use strict';

exports.default = void 0;
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
/**

@@ -25,22 +21,17 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

*/
const {remove: preRunMessageRemove} = _jestUtil().preRunMessage;
class BaseReporter {
_error;
log(message) {
process.stderr.write(`${message}\n`);
}
onRunStart(_results, _options) {
preRunMessageRemove(process.stderr);
}
/* eslint-disable @typescript-eslint/no-empty-function */
onTestCaseResult(_test, _testCaseResult) {}
onTestResult(_test, _testResult, _results) {}
onTestStart(_test) {}
onRunComplete(_testContexts, _aggregatedResults) {}

@@ -51,5 +42,6 @@ /* eslint-enable */

this._error = error;
} // Return an error that occurred during reporting. This error will
}
// Return an error that occurred during reporting. This error will
// define whether the test run was successful or failed.
getLastError() {

@@ -59,3 +51,2 @@ return this._error;

}
exports.default = BaseReporter;

@@ -7,131 +7,91 @@ 'use strict';

exports.default = void 0;
function path() {
const data = _interopRequireWildcard(require('path'));
path = function () {
return data;
};
return data;
}
function _v8Coverage() {
const data = require('@bcoe/v8-coverage');
_v8Coverage = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _glob() {
const data = _interopRequireDefault(require('glob'));
_glob = function () {
return data;
};
return data;
}
function fs() {
const data = _interopRequireWildcard(require('graceful-fs'));
fs = function () {
return data;
};
return data;
}
function _istanbulLibCoverage() {
const data = _interopRequireDefault(require('istanbul-lib-coverage'));
_istanbulLibCoverage = function () {
return data;
};
return data;
}
function _istanbulLibReport() {
const data = _interopRequireDefault(require('istanbul-lib-report'));
_istanbulLibReport = function () {
return data;
};
return data;
}
function _istanbulLibSourceMaps() {
const data = _interopRequireDefault(require('istanbul-lib-source-maps'));
_istanbulLibSourceMaps = function () {
return data;
};
return data;
}
function _istanbulReports() {
const data = _interopRequireDefault(require('istanbul-reports'));
_istanbulReports = function () {
return data;
};
return data;
}
function _v8ToIstanbul() {
const data = _interopRequireDefault(require('v8-to-istanbul'));
_v8ToIstanbul = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _jestWorker() {
const data = require('jest-worker');
_jestWorker = function () {
return data;
};
return data;
}
var _BaseReporter = _interopRequireDefault(require('./BaseReporter'));
var _getWatermarks = _interopRequireDefault(require('./getWatermarks'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _getRequireWildcardCache(nodeInterop) {

@@ -145,3 +105,2 @@ if (typeof WeakMap !== 'function') return null;

}
function _interopRequireWildcard(obj, nodeInterop) {

@@ -179,3 +138,2 @@ if (!nodeInterop && obj && obj.__esModule) {

}
/**

@@ -187,6 +145,5 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

*/
const FAIL_COLOR = _chalk().default.bold.red;
const RUNNING_TEST_COLOR = _chalk().default.bold.dim;
class CoverageReporter extends _BaseReporter.default {

@@ -199,3 +156,2 @@ _context;

static filename = __filename;
constructor(globalConfig, context) {

@@ -210,10 +166,7 @@ super();

}
onTestResult(_test, testResult) {
if (testResult.v8Coverage) {
this._v8CoverageResults.push(testResult.v8Coverage);
return;
}
if (testResult.coverage) {

@@ -223,21 +176,15 @@ this._coverageMap.merge(testResult.coverage);

}
async onRunComplete(testContexts, aggregatedResults) {
await this._addUntestedFiles(testContexts);
const {map, reportContext} = await this._getCoverageResult();
try {
const coverageReporters = this._globalConfig.coverageReporters || [];
if (!this._globalConfig.useStderr && coverageReporters.length < 1) {
coverageReporters.push('text-summary');
}
coverageReporters.forEach(reporter => {
let additionalOptions = {};
if (Array.isArray(reporter)) {
[reporter, additionalOptions] = reporter;
}
_istanbulReports()

@@ -260,6 +207,4 @@ .default.create(reporter, {

}
this._checkThreshold(map);
}
async _addUntestedFiles(testContexts) {

@@ -269,3 +214,2 @@ const files = [];

const config = context.config;
if (

@@ -288,7 +232,5 @@ this._globalConfig.collectCoverageFrom &&

});
if (!files.length) {
return;
}
if (_jestUtil().isInteractive) {

@@ -299,5 +241,3 @@ process.stderr.write(

}
let worker;
if (this._globalConfig.maxWorkers <= 1) {

@@ -315,11 +255,8 @@ worker = require('./CoverageWorker');

}
const instrumentation = files.map(async fileObj => {
const filename = fileObj.path;
const config = fileObj.config;
const hasCoverageData = this._v8CoverageResults.some(v8Res =>
v8Res.some(innerRes => innerRes.result.url === filename)
);
if (

@@ -344,3 +281,2 @@ !hasCoverageData &&

});
if (result) {

@@ -371,3 +307,2 @@ if (result.kind === 'V8Coverage') {

});
try {

@@ -378,7 +313,5 @@ await Promise.all(instrumentation);

}
if (_jestUtil().isInteractive) {
(0, _jestUtil().clearLine)(process.stderr);
}
if (worker && 'end' in worker && typeof worker.end === 'function') {

@@ -388,6 +321,4 @@ await worker.end();

}
_checkThreshold(map) {
const {coverageThreshold} = this._globalConfig;
if (coverageThreshold) {

@@ -400,3 +331,2 @@ function check(name, thresholds, actuals) {

const threshold = thresholds[key];
if (threshold !== undefined) {

@@ -416,3 +346,2 @@ if (threshold < 0) {

}
return errors;

@@ -423,3 +352,2 @@ },

}
const THRESHOLD_GROUP_TYPES = {

@@ -448,4 +376,6 @@ GLOB: 'glob',

: '';
const absoluteThresholdGroup = `${resolvedThresholdGroup}${suffix}`; // The threshold group might be a path:
const absoluteThresholdGroup = `${resolvedThresholdGroup}${suffix}`;
// The threshold group might be a path:
if (file.indexOf(absoluteThresholdGroup) === 0) {

@@ -455,7 +385,9 @@ groupTypeByThresholdGroup[thresholdGroup] =

return agg.concat([[file, thresholdGroup]]);
} // If the threshold group is not a path it might be a glob:
}
// If the threshold group is not a path it might be a glob:
// Note: glob.sync is slow. By memoizing the files matching each glob
// (rather than recalculating it for each covered file) we save a tonne
// of execution time.
if (filesByGlob[absoluteThresholdGroup] === undefined) {

@@ -466,3 +398,2 @@ filesByGlob[absoluteThresholdGroup] = _glob()

}
if (filesByGlob[absoluteThresholdGroup].indexOf(file) > -1) {

@@ -473,3 +404,2 @@ groupTypeByThresholdGroup[thresholdGroup] =

}
return agg;

@@ -479,7 +409,7 @@ },

);
if (pathOrGlobMatches.length > 0) {
return files.concat(pathOrGlobMatches);
} // Neither a glob or a path? Toss it in global if there's a global threshold:
}
// Neither a glob or a path? Toss it in global if there's a global threshold:
if (thresholdGroups.indexOf(THRESHOLD_GROUP_TYPES.GLOBAL) > -1) {

@@ -489,4 +419,5 @@ groupTypeByThresholdGroup[THRESHOLD_GROUP_TYPES.GLOBAL] =

return files.concat([[file, THRESHOLD_GROUP_TYPES.GLOBAL]]);
} // A covered file that doesn't have a threshold:
}
// A covered file that doesn't have a threshold:
return files.concat([[file, undefined]]);

@@ -496,3 +427,2 @@ },

);
const getFilesInThresholdGroup = thresholdGroup =>

@@ -502,3 +432,2 @@ coveredFilesSortedIntoThresholdGroup

.map(fileAndGroup => fileAndGroup[0]);
function combineCoverage(filePaths) {

@@ -511,7 +440,5 @@ return filePaths

}
return combinedCoverage.merge(nextFileCoverage.toSummary());
}, undefined);
}
let errors = [];

@@ -524,3 +451,2 @@ thresholdGroups.forEach(thresholdGroup => {

);
if (coverage) {

@@ -535,6 +461,4 @@ errors = errors.concat(

}
break;
}
case THRESHOLD_GROUP_TYPES.PATH: {

@@ -544,3 +468,2 @@ const coverage = combineCoverage(

);
if (coverage) {

@@ -555,6 +478,4 @@ errors = errors.concat(

}
break;
}
case THRESHOLD_GROUP_TYPES.GLOB:

@@ -573,3 +494,2 @@ getFilesInThresholdGroup(thresholdGroup).forEach(

break;
default:

@@ -582,3 +502,2 @@ // If the file specified by path is not found, error is returned.

}
// Sometimes all files in the coverage data are matched by

@@ -589,9 +508,8 @@ // PATH and GLOB threshold groups in which case, don't error when

});
errors = errors.filter(
err => err !== undefined && err !== null && err.length > 0
);
if (errors.length > 0) {
this.log(`${FAIL_COLOR(errors.join('\n'))}`);
this._setError(new Error(errors.join('\n')));

@@ -601,3 +519,2 @@ }

}
async _getCoverageResult() {

@@ -611,3 +528,2 @@ if (this._globalConfig.coverageProvider === 'v8') {

const fileTransforms = new Map();
this._v8CoverageResults.forEach(res =>

@@ -620,3 +536,2 @@ res.forEach(r => {

);
const transformedCoverage = await Promise.all(

@@ -626,3 +541,2 @@ mergedCoverages.result.map(async res => {

let sourcemapContent = undefined;
if (

@@ -636,3 +550,2 @@ fileTransform?.sourceMapPath &&

}
const converter = (0, _v8ToIstanbul().default)(

@@ -662,7 +575,4 @@ res.url,

);
const map = _istanbulLibCoverage().default.createCoverageMap({});
transformedCoverage.forEach(res => map.merge(res));
const reportContext = _istanbulLibReport().default.createContext({

@@ -673,3 +583,2 @@ coverageMap: map,

});
return {

@@ -680,5 +589,3 @@ map,

}
const map = await this._sourceMapStore.transformCoverage(this._coverageMap);
const reportContext = _istanbulLibReport().default.createContext({

@@ -690,3 +597,2 @@ coverageMap: map,

});
return {

@@ -698,3 +604,2 @@ map,

}
exports.default = CoverageReporter;

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

exports.worker = worker;
function _exit() {
const data = _interopRequireDefault(require('exit'));
_exit = function () {
return data;
};
return data;
}
function fs() {
const data = _interopRequireWildcard(require('graceful-fs'));
fs = function () {
return data;
};
return data;
}
var _generateEmptyCoverage = _interopRequireDefault(
require('./generateEmptyCoverage')
);
function _getRequireWildcardCache(nodeInterop) {

@@ -41,3 +33,2 @@ if (typeof WeakMap !== 'function') return null;

}
function _interopRequireWildcard(obj, nodeInterop) {

@@ -75,7 +66,5 @@ if (!nodeInterop && obj && obj.__esModule) {

}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**

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

*/
// Make sure uncaught errors are logged before we exit.

@@ -93,3 +83,2 @@ process.on('uncaughtException', err => {

});
function worker({config, globalConfig, path, context}) {

@@ -96,0 +85,0 @@ return (0, _generateEmptyCoverage.default)(

@@ -7,55 +7,37 @@ 'use strict';

exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _console() {
const data = require('@jest/console');
_console = function () {
return data;
};
return data;
}
function _jestMessageUtil() {
const data = require('jest-message-util');
_jestMessageUtil = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
var _BaseReporter = _interopRequireDefault(require('./BaseReporter'));
var _Status = _interopRequireDefault(require('./Status'));
var _getResultHeader = _interopRequireDefault(require('./getResultHeader'));
var _getSnapshotStatus = _interopRequireDefault(require('./getSnapshotStatus'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**

@@ -67,7 +49,6 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

*/
const TITLE_BULLET = _chalk().default.bold('\u25cf ');
class DefaultReporter extends _BaseReporter.default {
_clear; // ANSI clear sequence for the last printed status
_err;

@@ -79,3 +60,2 @@ _globalConfig;

static filename = __filename;
constructor(globalConfig) {

@@ -87,16 +67,11 @@ super();

this._err = process.stderr.write.bind(process.stderr);
this._status = new _Status.default();
this._status = new _Status.default(globalConfig);
this._bufferedOutput = new Set();
this.__wrapStdio(process.stdout);
this.__wrapStdio(process.stderr);
this._status.onChange(() => {
this.__clearStatus();
this.__printStatus();
});
}
__wrapStdio(stream) {

@@ -106,20 +81,15 @@ const write = stream.write.bind(stream);

let timeout = null;
const flushBufferedOutput = () => {
const string = buffer.join('');
buffer = []; // This is to avoid conflicts between random output and status text
buffer = [];
// This is to avoid conflicts between random output and status text
this.__clearStatus();
if (string) {
write(string);
}
this.__printStatus();
this._bufferedOutput.delete(flushBufferedOutput);
};
this._bufferedOutput.add(flushBufferedOutput);
const debouncedFlush = () => {

@@ -140,3 +110,2 @@ // If the process blows up no errors would be printed.

};
stream.write = chunk => {

@@ -147,4 +116,5 @@ buffer.push(chunk);

};
} // Don't wait for the debounced call and flush all output immediately.
}
// Don't wait for the debounced call and flush all output immediately.
forceFlushBufferedOutput() {

@@ -155,3 +125,2 @@ for (const flushBufferedOutput of this._bufferedOutput) {

}
__clearStatus() {

@@ -166,8 +135,5 @@ if (_jestUtil().isInteractive) {

}
__printStatus() {
const {content, clear} = this._status.get();
this._clear = clear;
if (_jestUtil().isInteractive) {

@@ -181,20 +147,14 @@ if (this._globalConfig.useStderr) {

}
onRunStart(aggregatedResults, options) {
this._status.runStarted(aggregatedResults, options);
}
onTestStart(test) {
this._status.testStarted(test.path, test.context.config);
}
onTestCaseResult(test, testCaseResult) {
this._status.addTestCaseResult(test, testCaseResult);
}
onRunComplete() {
this.forceFlushBufferedOutput();
this._status.runFinished();
process.stdout.write = this._out;

@@ -204,6 +164,4 @@ process.stderr.write = this._err;

}
onTestResult(test, testResult, aggregatedResults) {
this.testFinished(test.context.config, testResult, aggregatedResults);
if (!testResult.skipped) {

@@ -221,10 +179,7 @@ this.printTestFileHeader(

}
this.forceFlushBufferedOutput();
}
testFinished(config, testResult, aggregatedResults) {
this._status.testFinished(config, testResult, aggregatedResults);
}
printTestFileHeader(testPath, config, result) {

@@ -234,3 +189,2 @@ // log retry errors if any exist

const testRetryReasons = testResult.retryReasons;
if (testRetryReasons && testRetryReasons.length > 0) {

@@ -266,3 +220,2 @@ this.log(

this.log((0, _getResultHeader.default)(result, this._globalConfig, config));
if (result.console) {

@@ -278,3 +231,2 @@ this.log(

}
printTestFileFailureMessage(_testPath, _config, result) {

@@ -284,3 +236,2 @@ if (result.failureMessage) {

}
const didUpdate = this._globalConfig.updateSnapshot === 'all';

@@ -294,3 +245,2 @@ const snapshotStatuses = (0, _getSnapshotStatus.default)(

}
exports.default = DefaultReporter;

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

exports.default = formatTestPath;
function path() {
const data = _interopRequireWildcard(require('path'));
path = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _slash() {
const data = _interopRequireDefault(require('slash'));
_slash = function () {
return data;
};
return data;
}
var _relativePath = _interopRequireDefault(require('./relativePath'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _getRequireWildcardCache(nodeInterop) {

@@ -53,3 +41,2 @@ if (typeof WeakMap !== 'function') return null;

}
function _interopRequireWildcard(obj, nodeInterop) {

@@ -87,3 +74,2 @@ if (!nodeInterop && obj && obj.__esModule) {

}
/**

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

*/
function formatTestPath(config, testPath) {

@@ -97,0 +84,0 @@ const {dirname, basename} = (0, _relativePath.default)(config, testPath);

@@ -7,43 +7,30 @@ 'use strict';

exports.default = generateEmptyCoverage;
function fs() {
const data = _interopRequireWildcard(require('graceful-fs'));
fs = function () {
return data;
};
return data;
}
function _istanbulLibCoverage() {
const data = require('istanbul-lib-coverage');
_istanbulLibCoverage = function () {
return data;
};
return data;
}
function _istanbulLibInstrument() {
const data = require('istanbul-lib-instrument');
_istanbulLibInstrument = function () {
return data;
};
return data;
}
function _transform() {
const data = require('@jest/transform');
_transform = function () {
return data;
};
return data;
}
function _getRequireWildcardCache(nodeInterop) {

@@ -57,3 +44,2 @@ if (typeof WeakMap !== 'function') return null;

}
function _interopRequireWildcard(obj, nodeInterop) {

@@ -91,3 +77,2 @@ if (!nodeInterop && obj && obj.__esModule) {

}
/**

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

*/
async function generateEmptyCoverage(

@@ -116,3 +102,2 @@ source,

let coverageWorkerResult = null;
if ((0, _transform().shouldInstrument)(filename, coverageOptions, config)) {

@@ -142,7 +127,7 @@ if (coverageOptions.coverageProvider === 'v8') {

}
const scriptTransformer = await (0, _transform().createScriptTransformer)(
config
); // Transform file with instrumentation to make sure initial coverage data is well mapped to original code.
);
// Transform file with instrumentation to make sure initial coverage data is well mapped to original code.
const {code} = await scriptTransformer.transformSourceAsync(

@@ -158,6 +143,6 @@ filename,

}
); // TODO: consider passing AST
const extracted = (0, _istanbulLibInstrument().readInitialCoverage)(code); // Check extracted initial coverage is not null, this can happen when using /* istanbul ignore file */
);
// TODO: consider passing AST
const extracted = (0, _istanbulLibInstrument().readInitialCoverage)(code);
// Check extracted initial coverage is not null, this can happen when using /* istanbul ignore file */
if (extracted) {

@@ -172,4 +157,3 @@ coverageWorkerResult = {

}
return coverageWorkerResult;
}

@@ -7,41 +7,21 @@ 'use strict';

exports.default = getResultHeader;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _terminalLink() {
const data = _interopRequireDefault(require('terminal-link'));
_terminalLink = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
var _formatTestPath = _interopRequireDefault(require('./formatTestPath'));
var _printDisplayName = _interopRequireDefault(require('./printDisplayName'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**

@@ -53,5 +33,6 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

*/
const LONG_TEST_COLOR = _chalk().default.reset.bold.bgRed; // Explicitly reset for these messages since they can get written out in the
const LONG_TEST_COLOR = _chalk().default.reset.bold.bgRed;
// Explicitly reset for these messages since they can get written out in the
// middle of error logging
const FAIL_TEXT = 'FAIL';

@@ -65,20 +46,7 @@ const PASS_TEXT = 'PASS';

: PASS_TEXT;
function getResultHeader(result, globalConfig, projectConfig) {
const testPath = result.testFilePath;
const formattedTestPath = (0, _formatTestPath.default)(
projectConfig ? projectConfig : globalConfig,
testPath
);
const fileLink = (0, _terminalLink().default)(
formattedTestPath,
`file://${testPath}`,
{
fallback: () => formattedTestPath
}
);
const status =
result.numFailingTests > 0 || result.testExecError ? FAIL : PASS;
const testDetail = [];
if (result.perfStats?.slow) {

@@ -88,9 +56,6 @@ const runTime = result.perfStats.runtime / 1000;

}
if (result.memoryUsage) {
const toMB = bytes => Math.floor(bytes / 1024 / 1024);
testDetail.push(`${toMB(result.memoryUsage)} MB heap size`);
}
const projectDisplayName =

@@ -100,5 +65,6 @@ projectConfig && projectConfig.displayName

: '';
return `${status} ${projectDisplayName}${fileLink}${
testDetail.length ? ` (${testDetail.join(', ')})` : ''
}`;
return `${status} ${projectDisplayName}${(0, _formatTestPath.default)(
projectConfig ?? globalConfig,
testPath
)}${testDetail.length ? ` (${testDetail.join(', ')})` : ''}`;
}

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

exports.default = getSnapshotStatus;
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};
}
/**

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

*/
const ARROW = ' \u203A ';
const DOT = ' \u2022 ';
const FAIL_COLOR = _chalk().default.bold.red;
const SNAPSHOT_ADDED = _chalk().default.bold.green;
const SNAPSHOT_UPDATED = _chalk().default.bold.green;
const SNAPSHOT_OUTDATED = _chalk().default.bold.yellow;
function getSnapshotStatus(snapshot, afterUpdate) {
const statuses = [];
if (snapshot.added) {

@@ -63,3 +50,2 @@ statuses.push(

}
if (snapshot.updated) {

@@ -74,3 +60,2 @@ statuses.push(

}
if (snapshot.unmatched) {

@@ -85,3 +70,2 @@ statuses.push(

}
if (snapshot.unchecked) {

@@ -105,3 +89,2 @@ if (afterUpdate) {

}
snapshot.uncheckedKeys.forEach(key => {

@@ -111,8 +94,6 @@ statuses.push(` ${DOT}${key}`);

}
if (snapshot.fileDeleted) {
statuses.push(SNAPSHOT_UPDATED(`${ARROW}snapshot file removed.`));
}
return statuses;
}

@@ -7,29 +7,20 @@ 'use strict';

exports.default = getSnapshotSummary;
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;
}
var _formatTestPath = _interopRequireDefault(require('./formatTestPath'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**

@@ -41,24 +32,16 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

*/
const ARROW = ' \u203A ';
const DOWN_ARROW = ' \u21B3 ';
const DOT = ' \u2022 ';
const FAIL_COLOR = _chalk().default.bold.red;
const OBSOLETE_COLOR = _chalk().default.bold.yellow;
const SNAPSHOT_ADDED = _chalk().default.bold.green;
const SNAPSHOT_NOTE = _chalk().default.dim;
const SNAPSHOT_REMOVED = _chalk().default.bold.green;
const SNAPSHOT_SUMMARY = _chalk().default.bold;
const SNAPSHOT_UPDATED = _chalk().default.bold.green;
function getSnapshotSummary(snapshots, globalConfig, updateCommand) {
const summary = [];
summary.push(SNAPSHOT_SUMMARY('Snapshot Summary'));
if (snapshots.added) {

@@ -73,3 +56,2 @@ summary.push(

}
if (snapshots.unmatched) {

@@ -90,3 +72,2 @@ summary.push(

}
if (snapshots.updated) {

@@ -104,3 +85,2 @@ summary.push(

}
if (snapshots.filesRemoved) {

@@ -137,3 +117,2 @@ if (snapshots.didUpdate) {

}
if (snapshots.filesRemovedList && snapshots.filesRemovedList.length) {

@@ -153,3 +132,2 @@ const [head, ...tail] = snapshots.filesRemovedList;

}
if (snapshots.unchecked) {

@@ -185,3 +163,2 @@ if (snapshots.didUpdate) {

}
snapshots.uncheckedKeysByFile.forEach(uncheckedFile => {

@@ -199,4 +176,3 @@ summary.push(

}
return summary;
}

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

exports.default = getSummary;
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};
}
/**

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

*/
const PROGRESS_BAR_WIDTH = 40;
exports.PROGRESS_BAR_WIDTH = PROGRESS_BAR_WIDTH;
function getValuesCurrentTestCases(currentTestCases = []) {

@@ -56,3 +48,2 @@ let numFailingTests = 0;

}
case 'passed': {

@@ -62,3 +53,2 @@ numPassingTests++;

}
case 'skipped': {

@@ -68,3 +58,2 @@ numPendingTests++;

}
case 'todo': {

@@ -75,3 +64,2 @@ numTodoTests++;

}
numTotalTests++;

@@ -87,3 +75,2 @@ });

}
function renderTime(runTime, estimatedTime, width) {

@@ -96,8 +83,8 @@ // If we are more than one second over the estimated time, highlight it.

let time = `${_chalk().default.bold('Time:')} ${renderedTime}`;
if (runTime < estimatedTime) {
time += `, estimated ${(0, _jestUtil().formatTime)(estimatedTime, 0)}`;
} // Only show a progress bar if the test run is actually going to take
}
// Only show a progress bar if the test run is actually going to take
// some time.
if (estimatedTime > 2 && runTime < estimatedTime && width) {

@@ -109,3 +96,2 @@ const availableWidth = Math.min(PROGRESS_BAR_WIDTH, width);

);
if (availableWidth >= 2) {

@@ -117,13 +103,9 @@ time += `\n${_chalk().default.green('█').repeat(length)}${_chalk()

}
return time;
}
function getSummary(aggregatedResults, options) {
let runTime = (Date.now() - aggregatedResults.startTime) / 1000;
if (options && options.roundTime) {
runTime = Math.floor(runTime);
}
const valuesForCurrentTestCases = getValuesCurrentTestCases(

@@ -153,2 +135,10 @@ options?.currentTestCases

const width = (options && options.width) || 0;
const optionalLines = [];
if (options?.showSeed === true) {
const {seed} = options;
if (seed === undefined) {
throw new Error('Attempted to display seed but seed value is undefined');
}
optionalLines.push(`${_chalk().default.bold('Seed: ') + seed}`);
}
const suites = `${

@@ -226,3 +216,3 @@ _chalk().default.bold('Test Suites: ') +

const time = renderTime(runTime, estimatedTime, width);
return [suites, tests, snapshots, time].join('\n');
return [...optionalLines, suites, tests, snapshots, time].join('\n');
}

@@ -7,17 +7,12 @@ 'use strict';

exports.default = getWatermarks;
function _istanbulLibReport() {
const data = _interopRequireDefault(require('istanbul-lib-report'));
_istanbulLibReport = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**

@@ -29,21 +24,17 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

*/
function getWatermarks(config) {
const defaultWatermarks = _istanbulLibReport().default.getDefaultWatermarks();
const {coverageThreshold} = config;
if (!coverageThreshold || !coverageThreshold.global) {
return defaultWatermarks;
}
const keys = ['branches', 'functions', 'lines', 'statements'];
return keys.reduce((watermarks, key) => {
const value = coverageThreshold.global[key];
if (value !== undefined) {
watermarks[key][1] = value;
}
return watermarks;
}, defaultWatermarks);
}

@@ -7,29 +7,20 @@ 'use strict';

exports.default = void 0;
function _stripAnsi() {
const data = _interopRequireDefault(require('strip-ansi'));
_stripAnsi = function () {
return data;
};
return data;
}
function _jestMessageUtil() {
const data = require('jest-message-util');
_jestMessageUtil = function () {
return data;
};
return data;
}
var _BaseReporter = _interopRequireDefault(require('./BaseReporter'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**

@@ -41,7 +32,6 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

*/
const titleSeparator = ' \u203A ';
class GitHubActionsReporter extends _BaseReporter.default {
static filename = __filename;
onTestFileResult({context}, {testResults}) {

@@ -68,3 +58,2 @@ testResults.forEach(result => {

}
#getMessageDetails(failureMessage, config) {

@@ -86,3 +75,2 @@ const {message, stack} = (0, _jestMessageUtil().separateMessageFromStack)(

}
#createAnnotation({file, line, message, title, type}) {

@@ -98,3 +86,2 @@ message = (0, _stripAnsi().default)(

}
exports.default = GitHubActionsReporter;

@@ -46,7 +46,7 @@ /**

export declare class CoverageReporter extends BaseReporter {
private _context;
private _coverageMap;
private _globalConfig;
private _sourceMapStore;
private _v8CoverageResults;
private readonly _context;
private readonly _coverageMap;
private readonly _globalConfig;
private readonly _sourceMapStore;
private readonly _v8CoverageResults;
static readonly filename: string;

@@ -66,7 +66,7 @@ constructor(globalConfig: Config.GlobalConfig, context: ReporterContext);

private _clear;
private _err;
private readonly _err;
protected _globalConfig: Config.GlobalConfig;
private _out;
private _status;
private _bufferedOutput;
private readonly _out;
private readonly _status;
private readonly _bufferedOutput;
static readonly filename: string;

@@ -143,4 +143,4 @@ constructor(globalConfig: Config.GlobalConfig);

export declare class NotifyReporter extends BaseReporter {
private _notifier;
private _globalConfig;
private readonly _notifier;
private readonly _globalConfig;
private _context;

@@ -213,2 +213,4 @@ static readonly filename: string;

width?: number;
showSeed?: boolean;
seed?: number;
};

@@ -218,3 +220,3 @@

private _estimatedTime;
private _globalConfig;
private readonly _globalConfig;
static readonly filename: string;

@@ -221,0 +223,0 @@ constructor(globalConfig: Config.GlobalConfig);

@@ -49,41 +49,24 @@ 'use strict';

exports.utils = void 0;
var _formatTestPath = _interopRequireDefault(require('./formatTestPath'));
var _getResultHeader = _interopRequireDefault(require('./getResultHeader'));
var _getSnapshotStatus = _interopRequireDefault(require('./getSnapshotStatus'));
var _getSnapshotSummary = _interopRequireDefault(
require('./getSnapshotSummary')
);
var _getSummary = _interopRequireDefault(require('./getSummary'));
var _printDisplayName = _interopRequireDefault(require('./printDisplayName'));
var _relativePath = _interopRequireDefault(require('./relativePath'));
var _trimAndFormatPath = _interopRequireDefault(require('./trimAndFormatPath'));
var _BaseReporter = _interopRequireDefault(require('./BaseReporter'));
var _CoverageReporter = _interopRequireDefault(require('./CoverageReporter'));
var _DefaultReporter = _interopRequireDefault(require('./DefaultReporter'));
var _GitHubActionsReporter = _interopRequireDefault(
require('./GitHubActionsReporter')
);
var _NotifyReporter = _interopRequireDefault(require('./NotifyReporter'));
var _SummaryReporter = _interopRequireDefault(require('./SummaryReporter'));
var _VerboseReporter = _interopRequireDefault(require('./VerboseReporter'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**

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

*/
const utils = {

@@ -97,0 +81,0 @@ formatTestPath: _formatTestPath.default,

@@ -7,49 +7,34 @@ 'use strict';

exports.default = void 0;
function path() {
const data = _interopRequireWildcard(require('path'));
path = function () {
return data;
};
return data;
}
function util() {
const data = _interopRequireWildcard(require('util'));
util = function () {
return data;
};
return data;
}
function _exit() {
const data = _interopRequireDefault(require('exit'));
_exit = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
var _BaseReporter = _interopRequireDefault(require('./BaseReporter'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _getRequireWildcardCache(nodeInterop) {

@@ -63,3 +48,2 @@ if (typeof WeakMap !== 'function') return null;

}
function _interopRequireWildcard(obj, nodeInterop) {

@@ -97,3 +81,2 @@ if (!nodeInterop && obj && obj.__esModule) {

}
/**

@@ -105,5 +88,5 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

*/
const isDarwin = process.platform === 'darwin';
const icon = path().resolve(__dirname, '../assets/jest_logo.png');
class NotifyReporter extends _BaseReporter.default {

@@ -114,3 +97,2 @@ _notifier = loadNotifier();

static filename = __filename;
constructor(globalConfig, context) {

@@ -121,3 +103,2 @@ super();

}
onRunComplete(testContexts, result) {

@@ -130,3 +111,2 @@ const success =

let packageName;
if (hasteFS != null) {

@@ -142,3 +122,2 @@ // assuming root package.json is the first one

}
packageName = packageName != null ? `${packageName} - ` : '';

@@ -149,3 +128,2 @@ const notifyMode = this._globalConfig.notifyMode;

const testsHaveRun = result.numTotalTests !== 0;
if (

@@ -165,3 +143,2 @@ testsHaveRun &&

)} passed`;
this._notifier.notify({

@@ -197,3 +174,2 @@ hint: 'int:transient:1',

const quitAnswer = 'Exit tests';
if (!watchMode) {

@@ -223,3 +199,2 @@ this._notifier.notify({

}
if (metadata.activationValue === quitAnswer) {

@@ -229,3 +204,2 @@ (0, _exit().default)(0);

}
if (

@@ -241,3 +215,2 @@ metadata.activationValue === restartAnswer &&

}
this._context.previousSuccess = success;

@@ -247,5 +220,3 @@ this._context.firstRun = false;

}
exports.default = NotifyReporter;
function loadNotifier() {

@@ -258,3 +229,2 @@ try {

}
throw Error(

@@ -261,0 +231,0 @@ 'notify reporter requires optional peer dependency "node-notifier" but it was not found'

@@ -7,17 +7,12 @@ 'use strict';

exports.default = printDisplayName;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**

@@ -29,11 +24,9 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

*/
function printDisplayName(config) {
const {displayName} = config;
const white = _chalk().default.reset.inverse.white;
if (!displayName) {
return '';
}
const {name, color} = displayName;

@@ -40,0 +33,0 @@ const chosenColor = _chalk().default.reset.inverse[color]

@@ -7,13 +7,9 @@ 'use strict';

exports.default = relativePath;
function path() {
const data = _interopRequireWildcard(require('path'));
path = function () {
return data;
};
return data;
}
function _getRequireWildcardCache(nodeInterop) {

@@ -27,3 +23,2 @@ if (typeof WeakMap !== 'function') return null;

}
function _interopRequireWildcard(obj, nodeInterop) {

@@ -61,3 +56,2 @@ if (!nodeInterop && obj && obj.__esModule) {

}
/**

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

*/
function relativePath(config, testPath) {

@@ -71,0 +66,0 @@ // this function can be called with ProjectConfigs or GlobalConfigs. GlobalConfigs

@@ -7,35 +7,23 @@ 'use strict';

exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _stringLength() {
const data = _interopRequireDefault(require('string-length'));
_stringLength = function () {
return data;
};
return data;
}
var _getSummary = _interopRequireDefault(require('./getSummary'));
var _printDisplayName = _interopRequireDefault(require('./printDisplayName'));
var _trimAndFormatPath = _interopRequireDefault(require('./trimAndFormatPath'));
var _wrapAnsiString = _interopRequireDefault(require('./wrapAnsiString'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**

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

*/
const RUNNING_TEXT = ' RUNS ';
const RUNNING = `${_chalk().default.reset.inverse.yellow.bold(RUNNING_TEXT)} `;
/**

@@ -55,13 +45,9 @@ * This class is a perf optimization for sorting the list of currently

*/
class CurrentTestList {
_array;
constructor() {
this._array = [];
}
add(testPath, config) {
const index = this._array.indexOf(null);
const record = {

@@ -71,3 +57,2 @@ config,

};
if (index !== -1) {

@@ -79,3 +64,2 @@ this._array[index] = record;

}
delete(testPath) {

@@ -85,6 +69,4 @@ const record = this._array.find(

);
this._array[this._array.indexOf(record || null)] = null;
}
get() {

@@ -94,3 +76,2 @@ return this._array;

}
/**

@@ -112,4 +93,4 @@ * A class that generates the CLI status of currently running tests

_showStatus;
constructor() {
constructor(_globalConfig) {
this._globalConfig = _globalConfig;
this._cache = null;

@@ -123,7 +104,5 @@ this._currentTests = new CurrentTestList();

}
onChange(callback) {
this._callback = callback;
}
runStarted(aggregatedResults, options) {

@@ -134,13 +113,9 @@ this._estimatedTime = (options && options.estimatedTime) || 0;

this._aggregatedResults = aggregatedResults;
this._debouncedEmit();
}
runFinished() {
this._done = true;
if (this._interval) clearInterval(this._interval);
this._emit();
}
addTestCaseResult(test, testCaseResult) {

@@ -151,3 +126,2 @@ this._currentTestCases.push({

});
if (!this._showStatus) {

@@ -159,6 +133,4 @@ this._emit();

}
testStarted(testPath, config) {
this._currentTests.add(testPath, config);
if (!this._showStatus) {

@@ -170,9 +142,6 @@ this._emit();

}
testFinished(_config, testResult, aggregatedResults) {
const {testFilePath} = testResult;
this._aggregatedResults = aggregatedResults;
this._currentTests.delete(testFilePath);
this._currentTestCases = this._currentTestCases.filter(({test}) => {

@@ -182,9 +151,6 @@ if (_config !== test.context.config) {

}
return test.path !== testFilePath;
});
this._debouncedEmit();
}
get() {

@@ -194,3 +160,2 @@ if (this._cache) {

}
if (this._done) {

@@ -202,6 +167,4 @@ return {

}
const width = process.stdout.columns;
let content = '\n';
this._currentTests.get().forEach(record => {

@@ -226,3 +189,2 @@ if (record) {

});
if (this._showStatus && this._aggregatedResults) {

@@ -233,8 +195,8 @@ content += `\n${(0, _getSummary.default)(this._aggregatedResults, {

roundTime: true,
seed: this._globalConfig.seed,
showSeed: this._globalConfig.showSeed,
width
})}`;
}
let height = 0;
for (let i = 0; i < content.length; i++) {

@@ -245,3 +207,2 @@ if (content[i] === '\n') {

}
const clear = '\r\x1B[K\r\x1B[1A'.repeat(height);

@@ -253,3 +214,2 @@ return (this._cache = {

}
_emit() {

@@ -259,3 +219,2 @@ this._cache = null;

}
_debouncedEmit() {

@@ -268,3 +227,2 @@ if (!this._emitScheduled) {

this._emit();
this._emitScheduled = false;

@@ -274,3 +232,2 @@ }, 100);

}
_tick() {

@@ -280,3 +237,2 @@ this._debouncedEmit();

}
exports.default = Status;

@@ -7,37 +7,25 @@ 'use strict';

exports.default = void 0;
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;
}
var _BaseReporter = _interopRequireDefault(require('./BaseReporter'));
var _getResultHeader = _interopRequireDefault(require('./getResultHeader'));
var _getSnapshotSummary = _interopRequireDefault(
require('./getSnapshotSummary')
);
var _getSummary = _interopRequireDefault(require('./getSummary'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**

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

*/
const TEST_SUMMARY_THRESHOLD = 20;

@@ -79,3 +68,2 @@ const NPM_EVENTS = new Set([

process.env;
class SummaryReporter extends _BaseReporter.default {

@@ -85,3 +73,2 @@ _estimatedTime;

static filename = __filename;
constructor(globalConfig) {

@@ -91,3 +78,5 @@ super();

this._estimatedTime = 0;
} // If we write more than one character at a time it is possible that
}
// If we write more than one character at a time it is possible that
// Node.js exits in the middle of printing the result. This was first observed

@@ -97,3 +86,2 @@ // in Node.js 0.10 and still persists in Node.js 6.7+.

// when hundreds of tests are failing.
_write(string) {

@@ -104,3 +92,2 @@ for (let i = 0; i < string.length; i++) {

}
onRunStart(aggregatedResults, options) {

@@ -110,10 +97,8 @@ super.onRunStart(aggregatedResults, options);

}
onRunComplete(testContexts, aggregatedResults) {
const {numTotalTestSuites, testResults, wasInterrupted} = aggregatedResults;
if (numTotalTestSuites) {
const lastResult = testResults[testResults.length - 1]; // Print a newline if the last test did not fail to line up newlines
const lastResult = testResults[testResults.length - 1];
// Print a newline if the last test did not fail to line up newlines
// similar to when an error would have been thrown in the test.
if (

@@ -127,5 +112,3 @@ !this._globalConfig.verbose &&

}
this._printSummary(aggregatedResults, this._globalConfig);
this._printSnapshotSummary(

@@ -135,8 +118,8 @@ aggregatedResults.snapshot,

);
if (numTotalTestSuites) {
let message = (0, _getSummary.default)(aggregatedResults, {
estimatedTime: this._estimatedTime
estimatedTime: this._estimatedTime,
seed: this._globalConfig.seed,
showSeed: this._globalConfig.showSeed
});
if (!this._globalConfig.silent) {

@@ -149,3 +132,2 @@ message += `\n${

}
this.log(message);

@@ -155,3 +137,2 @@ }

}
_printSnapshotSummary(snapshots, globalConfig) {

@@ -175,3 +156,2 @@ if (

npm_lifecycle_script.includes('jest');
if (globalConfig.watch || globalConfig.watchAll) {

@@ -186,3 +166,2 @@ updateCommand = 'press `u`';

}
const snapshotSummary = (0, _getSnapshotSummary.default)(

@@ -203,3 +182,2 @@ snapshots,

const runtimeErrors = aggregatedResults.numRuntimeErrorTestSuites;
if (

@@ -212,3 +190,2 @@ failedTests + runtimeErrors > 0 &&

const {failureMessage} = testResult;
if (failureMessage) {

@@ -239,5 +216,3 @@ this._write(

};
let testInfo = '';
if (globalConfig.runTestsByPath) {

@@ -250,5 +225,3 @@ testInfo = _chalk().default.dim(' within paths');

}
let nameInfo = '';
if (globalConfig.runTestsByPath) {

@@ -261,3 +234,2 @@ nameInfo = ` ${globalConfig.nonFlagArgs.map(p => `"${p}"`).join(', ')}`;

}
const contextInfo =

@@ -278,3 +250,2 @@ testContexts.size > 1

}
exports.default = SummaryReporter;

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

exports.default = trimAndFormatPath;
function path() {
const data = _interopRequireWildcard(require('path'));
path = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _slash() {
const data = _interopRequireDefault(require('slash'));
_slash = function () {
return data;
};
return data;
}
var _relativePath = _interopRequireDefault(require('./relativePath'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _getRequireWildcardCache(nodeInterop) {

@@ -53,3 +41,2 @@ if (typeof WeakMap !== 'function') return null;

}
function _interopRequireWildcard(obj, nodeInterop) {

@@ -87,3 +74,2 @@ if (!nodeInterop && obj && obj.__esModule) {

}
/**

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

*/
function trimAndFormatPath(pad, config, testPath, columns) {

@@ -100,4 +87,5 @@ const maxLength = columns - pad;

const {basename} = relative;
let {dirname} = relative; // length is ok
let {dirname} = relative;
// length is ok
if ((dirname + path().sep + basename).length <= maxLength) {

@@ -108,6 +96,6 @@ return (0, _slash().default)(

);
} // we can fit trimmed dirname and full basename
}
// we can fit trimmed dirname and full basename
const basenameLength = basename.length;
if (basenameLength + 4 < maxLength) {

@@ -124,3 +112,2 @@ const dirnameLength = maxLength - 4 - basenameLength;

}
if (basenameLength + 4 === maxLength) {

@@ -130,4 +117,5 @@ return (0, _slash().default)(

);
} // can't fit dirname, but can fit trimmed basename
}
// can't fit dirname, but can fit trimmed basename
return (0, _slash().default)(

@@ -134,0 +122,0 @@ _chalk().default.bold(

@@ -7,29 +7,20 @@ 'use strict';

exports.default = void 0;
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;
}
var _DefaultReporter = _interopRequireDefault(require('./DefaultReporter'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**

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

*/
const {ICONS} = _jestUtil().specialChars;
class VerboseReporter extends _DefaultReporter.default {
_globalConfig;
static filename = __filename;
constructor(globalConfig) {
super(globalConfig);
this._globalConfig = globalConfig;
} // Verbose mode is for debugging. Buffering of output is undesirable.
}
// Verbose mode is for debugging. Buffering of output is undesirable.
// See https://github.com/facebook/jest/issues/8208
__wrapStdio(stream) {
const write = stream.write.bind(stream);
stream.write = chunk => {
this.__clearStatus();
write(chunk);
this.__printStatus();
return true;
};
}
static filterTestResults(testResults) {
return testResults.filter(({status}) => status !== 'pending');
}
static groupTestsBySuites(testResults) {

@@ -79,8 +64,8 @@ const root = {

testResults.forEach(testResult => {
let targetSuite = root; // Find the target suite for this test,
let targetSuite = root;
// Find the target suite for this test,
// creating nested suites as necessary.
for (const title of testResult.ancestorTitles) {
let matchingSuite = targetSuite.suites.find(s => s.title === title);
if (!matchingSuite) {

@@ -94,6 +79,4 @@ matchingSuite = {

}
targetSuite = matchingSuite;
}
targetSuite.tests.push(testResult);

@@ -103,6 +86,4 @@ });

}
onTestResult(test, result, aggregatedResults) {
super.testFinished(test.context.config, result, aggregatedResults);
if (!result.skipped) {

@@ -114,7 +95,5 @@ this.printTestFileHeader(

);
if (!result.testExecError && !result.skipped) {
this._logTestResults(result.testResults);
}
this.printTestFileFailureMessage(

@@ -126,12 +105,8 @@ result.testFilePath,

}
super.forceFlushBufferedOutput();
}
_logTestResults(testResults) {
this._logSuite(VerboseReporter.groupTestsBySuites(testResults), 0);
this._logLine();
}
_logSuite(suite, indentLevel) {

@@ -141,8 +116,5 @@ if (suite.title) {

}
this._logTests(suite.tests, indentLevel + 1);
suite.suites.forEach(suite => this._logSuite(suite, indentLevel + 1));
}
_getIcon(status) {

@@ -159,10 +131,7 @@ if (status === 'failed') {

}
_logTest(test, indentLevel) {
const status = this._getIcon(test.status);
const time = test.duration
? ` (${(0, _jestUtil().formatTime)(Math.round(test.duration))})`
: '';
this._logLine(

@@ -173,3 +142,2 @@ `${status} ${_chalk().default.dim(test.title + time)}`,

}
_logTests(tests, indentLevel) {

@@ -188,3 +156,2 @@ if (this._globalConfig.expand) {

}
return result;

@@ -197,7 +164,5 @@ },

);
if (summedTests.pending.length > 0) {
summedTests.pending.forEach(this._logTodoOrPendingTest(indentLevel));
}
if (summedTests.todo.length > 0) {

@@ -208,3 +173,2 @@ summedTests.todo.forEach(this._logTodoOrPendingTest(indentLevel));

}
_logTodoOrPendingTest(indentLevel) {

@@ -214,11 +178,7 @@ return test => {

test.status === 'pending' ? 'skipped' : test.status;
const icon = this._getIcon(test.status);
const text = _chalk().default.dim(`${printedTestStatus} ${test.title}`);
this._logLine(`${icon} ${text}`, indentLevel);
};
}
_logLine(str, indentLevel) {

@@ -229,3 +189,2 @@ const indentation = ' '.repeat(indentLevel || 0);

}
exports.default = VerboseReporter;

@@ -7,3 +7,2 @@ 'use strict';

exports.default = wrapAnsiString;
/**

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

*/
// word-wrap a string that contains ANSI escape sequences.

@@ -23,3 +23,2 @@ // ANSI escape sequences do not add to the string length.

}
const ANSI_REGEXP = /[\u001b\u009b]\[\d{1,2}m/gu;

@@ -29,19 +28,14 @@ const tokens = [];

let match;
while ((match = ANSI_REGEXP.exec(string))) {
const ansi = match[0];
const index = match['index'];
const index = match.index;
if (index != lastIndex) {
tokens.push(['string', string.slice(lastIndex, index)]);
}
tokens.push(['ansi', ansi]);
lastIndex = index + ansi.length;
}
if (lastIndex != string.length - 1) {
tokens.push(['string', string.slice(lastIndex, string.length)]);
}
let lastLineLength = 0;

@@ -62,3 +56,2 @@ return tokens

token = remaining;
if (token.length) {

@@ -76,3 +69,2 @@ lines.push('');

}
return lines;

@@ -79,0 +71,0 @@ },

{
"name": "@jest/reporters",
"description": "Jest's reporters",
"version": "29.1.2",
"version": "29.2.0",
"main": "./build/index.js",

@@ -16,6 +16,6 @@ "types": "./build/index.d.ts",

"@bcoe/v8-coverage": "^0.2.3",
"@jest/console": "^29.1.2",
"@jest/test-result": "^29.1.2",
"@jest/transform": "^29.1.2",
"@jest/types": "^29.1.2",
"@jest/console": "^29.2.0",
"@jest/test-result": "^29.2.0",
"@jest/transform": "^29.2.0",
"@jest/types": "^29.2.0",
"@jridgewell/trace-mapping": "^0.3.15",

@@ -33,13 +33,12 @@ "@types/node": "*",

"istanbul-reports": "^3.1.3",
"jest-message-util": "^29.1.2",
"jest-util": "^29.1.2",
"jest-worker": "^29.1.2",
"jest-message-util": "^29.2.0",
"jest-util": "^29.2.0",
"jest-worker": "^29.2.0",
"slash": "^3.0.0",
"string-length": "^4.0.1",
"strip-ansi": "^6.0.0",
"terminal-link": "^2.0.0",
"v8-to-istanbul": "^9.0.1"
},
"devDependencies": {
"@jest/test-utils": "^29.1.2",
"@jest/test-utils": "^29.2.0",
"@tsd/typescript": "~4.8.2",

@@ -55,3 +54,3 @@ "@types/exit": "^0.1.30",

"@types/node-notifier": "^8.0.0",
"jest-resolve": "^29.1.2",
"jest-resolve": "^29.2.0",
"mock-fs": "^5.1.2",

@@ -84,3 +83,3 @@ "tsd-lite": "^0.6.0"

},
"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