refactor(cli): match test-result helper name to documented contract (#6122)
Co-authored-by: James George <25279263+jamesgeorge007@users.noreply.github.com>
This commit is contained in:
parent
3e63bdab02
commit
5d855f95c9
2 changed files with 6 additions and 7 deletions
|
|
@ -30,7 +30,7 @@ import {
|
|||
} from "./display";
|
||||
import { getDurationInSeconds, getMetaDataPairs } from "./getters";
|
||||
import { preRequestScriptRunner } from "./pre-request";
|
||||
import { getTestScriptParams, hasFailedTestCases, testRunner } from "./test";
|
||||
import { getTestScriptParams, hasAllTestsPassed, testRunner } from "./test";
|
||||
|
||||
/**
|
||||
* Processes given variable, which includes checking for secret variables
|
||||
|
|
@ -337,7 +337,7 @@ export const processRequest =
|
|||
report.result = false;
|
||||
} else {
|
||||
const { envs, testsReport, duration } = testRunnerRes.right;
|
||||
const _hasFailedTestCases = hasFailedTestCases(testsReport);
|
||||
const _allTestsPassed = hasAllTestsPassed(testsReport);
|
||||
|
||||
// Check if any tests have uncaught runtime errors (e.g., ReferenceError, TypeError)
|
||||
// Don't include validation errors (they're reported as individual testcases)
|
||||
|
|
@ -369,7 +369,7 @@ export const processRequest =
|
|||
|
||||
// Updating report with current tests, result and duration.
|
||||
report.tests = testsReport;
|
||||
report.result = report.result && _hasFailedTestCases;
|
||||
report.result = report.result && _allTestsPassed;
|
||||
report.duration.test = duration;
|
||||
|
||||
// Updating resulting envs from test-runner.
|
||||
|
|
|
|||
|
|
@ -237,12 +237,11 @@ export const getFailedExpectedResults = (expectResults: ExpectResult[]) =>
|
|||
);
|
||||
|
||||
/**
|
||||
* Checks if any of the tests-report have failed test-cases.
|
||||
* Checks whether every test report has zero failed test cases.
|
||||
* @param testsReport Provides "failed" test-cases data.
|
||||
* @returns True, if one or more failed test-cases found.
|
||||
* False, if all test-cases passed.
|
||||
* @returns True, if all test-cases passed. False, otherwise.
|
||||
*/
|
||||
export const hasFailedTestCases = (testsReport: TestReport[]) =>
|
||||
export const hasAllTestsPassed = (testsReport: TestReport[]) =>
|
||||
pipe(
|
||||
testsReport,
|
||||
A.every(({ failed }) => failed === 0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue