From 110ea3ff4571c32e60a549df664478cd33cba3ba Mon Sep 17 00:00:00 2001 From: abose Date: Fri, 6 Oct 2023 15:36:16 +0530 Subject: [PATCH] chore: test framework now reports jasmine error outside of test runs in console --- test/UnitTestReporter.js | 1 + tests-playwright/integration/integration-test-suite.spec.js | 5 +++++ tests-playwright/unit/unit-test-suite.spec.js | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/test/UnitTestReporter.js b/test/UnitTestReporter.js index 720f1f8b6..3946b0fa7 100644 --- a/test/UnitTestReporter.js +++ b/test/UnitTestReporter.js @@ -295,6 +295,7 @@ define(function (require, exports, module) { if(self.totalFailedCount === 0){ testRunnerLogToConsole(`\u2714 All(${self.totalSpecCount}) tests passed.`); if(result.overallStatus !== 'passed') { + window.externalJasmineFailures = true; testRunnerErrorToConsole(`\u2716 Some suites was detected to have failures outside of the suite tests. This could indicate an underlying problem. please run tests locally to debug.`); for(const element of result.failedExpectations) { if(element.stack){ diff --git a/tests-playwright/integration/integration-test-suite.spec.js b/tests-playwright/integration/integration-test-suite.spec.js index 8810bb34d..17ffefff1 100644 --- a/tests-playwright/integration/integration-test-suite.spec.js +++ b/tests-playwright/integration/integration-test-suite.spec.js @@ -19,6 +19,11 @@ async function execTests(page, url) { return Promise.resolve(window.testResults); }); expect(result.errors).toStrictEqual({}); + + const externalJasmineFailures = await page.evaluate(() => { + return Promise.resolve(window.externalJasmineFailures); + }); + expect(externalJasmineFailures).toEqual(undefined); } test("Execute integration tests", async ({ page }) => { diff --git a/tests-playwright/unit/unit-test-suite.spec.js b/tests-playwright/unit/unit-test-suite.spec.js index 5ce51c099..2741a5bc8 100644 --- a/tests-playwright/unit/unit-test-suite.spec.js +++ b/tests-playwright/unit/unit-test-suite.spec.js @@ -20,4 +20,9 @@ test("Execute all unit tests", async ({ page }) => { return Promise.resolve(window.testResults); }); expect(result.errors).toStrictEqual({}); + + const externalJasmineFailures = await page.evaluate(() => { + return Promise.resolve(window.externalJasmineFailures); + }); + expect(externalJasmineFailures).toEqual(undefined); });