Socket
Socket
Sign inDemoInstall

@jest/test-result

Package Overview
Dependencies
39
Maintainers
3
Versions
108
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 29.7.0 to 30.0.0-alpha.1

build/index.mjs

5

build/index.d.ts

@@ -188,2 +188,7 @@ /**

displayName?: Config.DisplayName;
/**
* Whether [`test.failing()`](https://jestjs.io/docs/api#testfailingname-fn-timeout)
* was used.
*/
failing?: boolean;
failureMessage?: string | null;

@@ -190,0 +195,0 @@ leaks: boolean;

312

build/index.js

@@ -1,7 +0,282 @@

'use strict';
/*!
* /**
* * Copyright (c) Meta Platforms, Inc. and affiliates.
* *
* * This source code is licensed under the MIT license found in the
* * LICENSE file in the root directory of this source tree.
* * /
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
Object.defineProperty(exports, '__esModule', {
/***/ "./src/formatTestResults.ts":
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = formatTestResults;
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const formatTestResult = (testResult, codeCoverageFormatter, reporter) => {
if (testResult.testExecError) {
const now = Date.now();
return {
assertionResults: testResult.testResults,
coverage: {},
endTime: now,
message: testResult.failureMessage ?? testResult.testExecError.message,
name: testResult.testFilePath,
startTime: now,
status: 'failed',
summary: ''
};
}
if (testResult.skipped) {
const now = Date.now();
return {
assertionResults: testResult.testResults,
coverage: {},
endTime: now,
message: testResult.failureMessage ?? '',
name: testResult.testFilePath,
startTime: now,
status: 'skipped',
summary: ''
};
}
const allTestsExecuted = testResult.numPendingTests === 0;
const allTestsPassed = testResult.numFailingTests === 0;
return {
assertionResults: testResult.testResults,
coverage: codeCoverageFormatter == null ? testResult.coverage : codeCoverageFormatter(testResult.coverage, reporter),
endTime: testResult.perfStats.end,
message: testResult.failureMessage ?? '',
name: testResult.testFilePath,
startTime: testResult.perfStats.start,
status: allTestsPassed ? allTestsExecuted ? 'passed' : 'focused' : 'failed',
summary: ''
};
};
function formatTestResults(results, codeCoverageFormatter, reporter) {
const testResults = results.testResults.map(testResult => formatTestResult(testResult, codeCoverageFormatter, reporter));
return {
...results,
testResults
};
}
/***/ }),
/***/ "./src/helpers.ts":
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.makeEmptyAggregatedTestResult = exports.createEmptyTestResult = exports.buildFailureTestResult = exports.addResult = void 0;
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const makeEmptyAggregatedTestResult = () => ({
numFailedTestSuites: 0,
numFailedTests: 0,
numPassedTestSuites: 0,
numPassedTests: 0,
numPendingTestSuites: 0,
numPendingTests: 0,
numRuntimeErrorTestSuites: 0,
numTodoTests: 0,
numTotalTestSuites: 0,
numTotalTests: 0,
openHandles: [],
snapshot: {
added: 0,
didUpdate: false,
// is set only after the full run
failure: false,
filesAdded: 0,
// combines individual test results + removed files after the full run
filesRemoved: 0,
filesRemovedList: [],
filesUnmatched: 0,
filesUpdated: 0,
matched: 0,
total: 0,
unchecked: 0,
uncheckedKeysByFile: [],
unmatched: 0,
updated: 0
},
startTime: 0,
success: true,
testResults: [],
wasInterrupted: false
});
Object.defineProperty(exports, 'addResult', {
exports.makeEmptyAggregatedTestResult = makeEmptyAggregatedTestResult;
const buildFailureTestResult = (testPath, err) => ({
console: undefined,
displayName: undefined,
failureMessage: null,
leaks: false,
numFailingTests: 0,
numPassingTests: 0,
numPendingTests: 0,
numTodoTests: 0,
openHandles: [],
perfStats: {
end: 0,
runtime: 0,
slow: false,
start: 0
},
skipped: false,
snapshot: {
added: 0,
fileDeleted: false,
matched: 0,
unchecked: 0,
uncheckedKeys: [],
unmatched: 0,
updated: 0
},
testExecError: err,
testFilePath: testPath,
testResults: []
});
// Add individual test result to an aggregated test result
exports.buildFailureTestResult = buildFailureTestResult;
const addResult = (aggregatedResults, testResult) => {
// `todos` are new as of Jest 24, and not all runners return it.
// Set it to `0` to avoid `NaN`
if (!testResult.numTodoTests) {
testResult.numTodoTests = 0;
}
aggregatedResults.testResults.push(testResult);
aggregatedResults.numTotalTests += testResult.numPassingTests + testResult.numFailingTests + testResult.numPendingTests + testResult.numTodoTests;
aggregatedResults.numFailedTests += testResult.numFailingTests;
aggregatedResults.numPassedTests += testResult.numPassingTests;
aggregatedResults.numPendingTests += testResult.numPendingTests;
aggregatedResults.numTodoTests += testResult.numTodoTests;
if (testResult.testExecError) {
aggregatedResults.numRuntimeErrorTestSuites++;
}
if (testResult.skipped) {
aggregatedResults.numPendingTestSuites++;
} else if (testResult.numFailingTests > 0 || testResult.testExecError) {
aggregatedResults.numFailedTestSuites++;
} else {
aggregatedResults.numPassedTestSuites++;
}
// Snapshot data
if (testResult.snapshot.added) {
aggregatedResults.snapshot.filesAdded++;
}
if (testResult.snapshot.fileDeleted) {
aggregatedResults.snapshot.filesRemoved++;
}
if (testResult.snapshot.unmatched) {
aggregatedResults.snapshot.filesUnmatched++;
}
if (testResult.snapshot.updated) {
aggregatedResults.snapshot.filesUpdated++;
}
aggregatedResults.snapshot.added += testResult.snapshot.added;
aggregatedResults.snapshot.matched += testResult.snapshot.matched;
aggregatedResults.snapshot.unchecked += testResult.snapshot.unchecked;
if (testResult.snapshot.uncheckedKeys != null && testResult.snapshot.uncheckedKeys.length > 0) {
aggregatedResults.snapshot.uncheckedKeysByFile.push({
filePath: testResult.testFilePath,
keys: testResult.snapshot.uncheckedKeys
});
}
aggregatedResults.snapshot.unmatched += testResult.snapshot.unmatched;
aggregatedResults.snapshot.updated += testResult.snapshot.updated;
aggregatedResults.snapshot.total += testResult.snapshot.added + testResult.snapshot.matched + testResult.snapshot.unmatched + testResult.snapshot.updated;
};
exports.addResult = addResult;
const createEmptyTestResult = () => ({
leaks: false,
// That's legacy code, just adding it as needed for typing
numFailingTests: 0,
numPassingTests: 0,
numPendingTests: 0,
numTodoTests: 0,
openHandles: [],
perfStats: {
end: 0,
runtime: 0,
slow: false,
start: 0
},
skipped: false,
snapshot: {
added: 0,
fileDeleted: false,
matched: 0,
unchecked: 0,
uncheckedKeys: [],
unmatched: 0,
updated: 0
},
testFilePath: '',
testResults: []
});
exports.createEmptyTestResult = createEmptyTestResult;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
var exports = __webpack_exports__;
Object.defineProperty(exports, "__esModule", ({
value: true
}));
Object.defineProperty(exports, "addResult", ({
enumerable: true,

@@ -11,4 +286,4 @@ get: function () {

}
});
Object.defineProperty(exports, 'buildFailureTestResult', {
}));
Object.defineProperty(exports, "buildFailureTestResult", ({
enumerable: true,

@@ -18,4 +293,4 @@ get: function () {

}
});
Object.defineProperty(exports, 'createEmptyTestResult', {
}));
Object.defineProperty(exports, "createEmptyTestResult", ({
enumerable: true,

@@ -25,4 +300,4 @@ get: function () {

}
});
Object.defineProperty(exports, 'formatTestResults', {
}));
Object.defineProperty(exports, "formatTestResults", ({
enumerable: true,

@@ -32,4 +307,4 @@ get: function () {

}
});
Object.defineProperty(exports, 'makeEmptyAggregatedTestResult', {
}));
Object.defineProperty(exports, "makeEmptyAggregatedTestResult", ({
enumerable: true,

@@ -39,7 +314,10 @@ get: function () {

}
});
var _formatTestResults = _interopRequireDefault(require('./formatTestResults'));
var _helpers = require('./helpers');
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
}));
var _formatTestResults = _interopRequireDefault(__webpack_require__("./src/formatTestResults.ts"));
var _helpers = __webpack_require__("./src/helpers.ts");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
})();
module.exports = __webpack_exports__;
/******/ })()
;

16

package.json
{
"name": "@jest/test-result",
"version": "29.7.0",
"version": "30.0.0-alpha.1",
"repository": {

@@ -15,2 +15,4 @@ "type": "git",

"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"

@@ -21,4 +23,4 @@ },

"dependencies": {
"@jest/console": "^29.7.0",
"@jest/types": "^29.6.3",
"@jest/console": "30.0.0-alpha.1",
"@jest/types": "30.0.0-alpha.1",
"@types/istanbul-lib-coverage": "^2.0.0",

@@ -28,7 +30,7 @@ "collect-v8-coverage": "^1.0.0"

"devDependencies": {
"jest-haste-map": "^29.7.0",
"jest-resolve": "^29.7.0"
"jest-haste-map": "30.0.0-alpha.1",
"jest-resolve": "30.0.0-alpha.1"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
"node": "^16.10.0 || ^18.12.0 || >=20.0.0"
},

@@ -38,3 +40,3 @@ "publishConfig": {

},
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
"gitHead": "d005cb2505c041583e0c5636d006e08666a54b63"
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc