From 3e52d5e72b96d0ef357c3e9fe0eec68a614db384 Mon Sep 17 00:00:00 2001 From: Ivan Ortega Alba Date: Tue, 20 Dec 2022 19:36:18 +0100 Subject: [PATCH] Fix: Report E2E result stack trace (#60596) --- e2e/log-reporter.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/e2e/log-reporter.js b/e2e/log-reporter.js index 36878fc6bbd..6303553f821 100644 --- a/e2e/log-reporter.js +++ b/e2e/log-reporter.js @@ -3,24 +3,24 @@ const Mocha = require('mocha'); const { EVENT_TEST_END, EVENT_RUN_END, EVENT_TEST_FAIL, EVENT_TEST_PASS } = Mocha.Runner.constants; -class LogReporter extends Mocha.reporters.Base { +class LogReporter extends Mocha.reporters.Spec { constructor(runner, options = {}) { super(runner, options); - this.tests = []; - this.failures = []; - this.passes = []; + this._testsResults = []; + this._testFailures = []; + this._testPasses = []; runner.on(EVENT_TEST_END, (test) => { - this.tests.push(cleanTest(test)); + this._testsResults.push(test); }); runner.on(EVENT_TEST_PASS, (test) => { - this.passes.push(cleanTest(test)); + this._testPasses.push(test); }); runner.on(EVENT_TEST_FAIL, (test) => { - this.failures.push(cleanTest(test)); + this._testFailures.push(test); }); runner.once(EVENT_RUN_END, () => { @@ -39,13 +39,13 @@ class LogReporter extends Mocha.reporters.Base { }; // Example - // CypressStats suites=1 tests=2 passes=1 pending=0 failures=1 + // CypressStats suites=1 tests=2 testPasses=1 pending=0 failures=1 // start=1668783563731 end=1668783645198 duration=81467 console.log(`CypressStats ${objToLogAttributes(stats)}`); } reportResults() { - this.tests.map((test) => { + this._testsResults.map(cleanTest).map((test) => { // Example // CypressTestResult title="Login scenario, create test data source, dashboard, panel, and export scenario" // suite="Smoke tests" file=../../e2e/smoke-tests-suite/1-smoketests.spec.ts duration=68694 @@ -55,7 +55,7 @@ class LogReporter extends Mocha.reporters.Base { } reportErrors() { - this.failures.forEach((failure) => { + this._testFailures.map(cleanTest).forEach((failure) => { const suite = failure.suite; const test = failure.title; const error = failure.err;