UNPKG

e2ed

Version:

E2E testing framework over Playwright

23 lines (22 loc) 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.calculateTestRunStatus = void 0; const asserts_1 = require("../asserts"); const clone_1 = require("../clone"); /** * Calculates final test run status by start test run event and end test run event. * @internal */ const calculateTestRunStatus = ({ endTestRunEvent, testRunEvent }) => { const { hasRunError, unknownRunError } = endTestRunEvent; const { status: originalStatus } = testRunEvent; let status = originalStatus === "skipped" /* TestRunStatus.Skipped */ ? "skipped" /* TestRunStatus.Skipped */ : "passed" /* TestRunStatus.Passed */; if (hasRunError) { const logPayload = { endTestRunEvent, testRunEvent: (0, clone_1.cloneWithoutLogEvents)(testRunEvent) }; (0, asserts_1.assertValueIsFalse)(status === "skipped" /* TestRunStatus.Skipped */, `status is not ${"skipped" /* TestRunStatus.Skipped */}`, logPayload); const isTestRunBroken = Boolean(unknownRunError?.isTestRunBroken); status = isTestRunBroken ? "broken" /* TestRunStatus.Broken */ : "failed" /* TestRunStatus.Failed */; } return status; }; exports.calculateTestRunStatus = calculateTestRunStatus;