aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@jest/test-result/build/helpers.js
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.h.kronqvist@gmail.com>2022-03-05 19:02:27 +0200
committerJoel Kronqvist <joel.h.kronqvist@gmail.com>2022-03-05 19:02:27 +0200
commit5d309ff52cd399a6b71968a6b9a70c8ac0b98981 (patch)
tree360f7eb50f956e2367ef38fa1fc6ac7ac5258042 /node_modules/@jest/test-result/build/helpers.js
parentb500a50f1b97d93c98b36ed9a980f8188d648147 (diff)
downloadLYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.tar.gz
LYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.zip
Added node_modules for the updating to work properly.
Diffstat (limited to 'node_modules/@jest/test-result/build/helpers.js')
-rw-r--r--node_modules/@jest/test-result/build/helpers.js188
1 files changed, 188 insertions, 0 deletions
diff --git a/node_modules/@jest/test-result/build/helpers.js b/node_modules/@jest/test-result/build/helpers.js
new file mode 100644
index 0000000..c63ad6b
--- /dev/null
+++ b/node_modules/@jest/test-result/build/helpers.js
@@ -0,0 +1,188 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', {
+ value: true
+});
+exports.makeEmptyAggregatedTestResult =
+ exports.createEmptyTestResult =
+ exports.buildFailureTestResult =
+ exports.addResult =
+ void 0;
+
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
+ *
+ * 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
+});
+
+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 &&
+ 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;