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:
Basavaraj_m_n 2026-04-15 13:48:30 +05:30 committed by GitHub
parent 3e63bdab02
commit 5d855f95c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 7 deletions

View file

@ -30,7 +30,7 @@ import {
} from "./display"; } from "./display";
import { getDurationInSeconds, getMetaDataPairs } from "./getters"; import { getDurationInSeconds, getMetaDataPairs } from "./getters";
import { preRequestScriptRunner } from "./pre-request"; 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 * Processes given variable, which includes checking for secret variables
@ -337,7 +337,7 @@ export const processRequest =
report.result = false; report.result = false;
} else { } else {
const { envs, testsReport, duration } = testRunnerRes.right; 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) // Check if any tests have uncaught runtime errors (e.g., ReferenceError, TypeError)
// Don't include validation errors (they're reported as individual testcases) // 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. // Updating report with current tests, result and duration.
report.tests = testsReport; report.tests = testsReport;
report.result = report.result && _hasFailedTestCases; report.result = report.result && _allTestsPassed;
report.duration.test = duration; report.duration.test = duration;
// Updating resulting envs from test-runner. // Updating resulting envs from test-runner.

View file

@ -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. * @param testsReport Provides "failed" test-cases data.
* @returns True, if one or more failed test-cases found. * @returns True, if all test-cases passed. False, otherwise.
* False, if all test-cases passed.
*/ */
export const hasFailedTestCases = (testsReport: TestReport[]) => export const hasAllTestsPassed = (testsReport: TestReport[]) =>
pipe( pipe(
testsReport, testsReport,
A.every(({ failed }) => failed === 0) A.every(({ failed }) => failed === 0)