mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 00:47:38 -06:00
Fix: Report E2E result stack trace (#60596)
This commit is contained in:
parent
620cc52863
commit
3e52d5e72b
@ -3,24 +3,24 @@
|
|||||||
const Mocha = require('mocha');
|
const Mocha = require('mocha');
|
||||||
const { EVENT_TEST_END, EVENT_RUN_END, EVENT_TEST_FAIL, EVENT_TEST_PASS } = Mocha.Runner.constants;
|
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 = {}) {
|
constructor(runner, options = {}) {
|
||||||
super(runner, options);
|
super(runner, options);
|
||||||
|
|
||||||
this.tests = [];
|
this._testsResults = [];
|
||||||
this.failures = [];
|
this._testFailures = [];
|
||||||
this.passes = [];
|
this._testPasses = [];
|
||||||
|
|
||||||
runner.on(EVENT_TEST_END, (test) => {
|
runner.on(EVENT_TEST_END, (test) => {
|
||||||
this.tests.push(cleanTest(test));
|
this._testsResults.push(test);
|
||||||
});
|
});
|
||||||
|
|
||||||
runner.on(EVENT_TEST_PASS, (test) => {
|
runner.on(EVENT_TEST_PASS, (test) => {
|
||||||
this.passes.push(cleanTest(test));
|
this._testPasses.push(test);
|
||||||
});
|
});
|
||||||
|
|
||||||
runner.on(EVENT_TEST_FAIL, (test) => {
|
runner.on(EVENT_TEST_FAIL, (test) => {
|
||||||
this.failures.push(cleanTest(test));
|
this._testFailures.push(test);
|
||||||
});
|
});
|
||||||
|
|
||||||
runner.once(EVENT_RUN_END, () => {
|
runner.once(EVENT_RUN_END, () => {
|
||||||
@ -39,13 +39,13 @@ class LogReporter extends Mocha.reporters.Base {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Example
|
// 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
|
// start=1668783563731 end=1668783645198 duration=81467
|
||||||
console.log(`CypressStats ${objToLogAttributes(stats)}`);
|
console.log(`CypressStats ${objToLogAttributes(stats)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
reportResults() {
|
reportResults() {
|
||||||
this.tests.map((test) => {
|
this._testsResults.map(cleanTest).map((test) => {
|
||||||
// Example
|
// Example
|
||||||
// CypressTestResult title="Login scenario, create test data source, dashboard, panel, and export scenario"
|
// 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
|
// 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() {
|
reportErrors() {
|
||||||
this.failures.forEach((failure) => {
|
this._testFailures.map(cleanTest).forEach((failure) => {
|
||||||
const suite = failure.suite;
|
const suite = failure.suite;
|
||||||
const test = failure.title;
|
const test = failure.title;
|
||||||
const error = failure.err;
|
const error = failure.err;
|
||||||
|
Loading…
Reference in New Issue
Block a user