From 447d3fc4e9d354e4c941c36aacd190aab6452323 Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Tue, 9 Jul 2024 14:34:54 +0200 Subject: [PATCH] feature: improve the collecting information about failed tests All error messages and traces will be saved in the stacktrace field. --- qase-cucumberjs/changelog.md | 7 +++++++ qase-cucumberjs/package.json | 2 +- qase-cucumberjs/src/storage.ts | 2 +- qase-cypress/changelog.md | 7 +++++++ qase-cypress/package.json | 2 +- qase-cypress/src/reporter.ts | 2 +- qase-jest/changelog.md | 7 +++++++ qase-jest/package.json | 2 +- qase-jest/src/reporter.ts | 2 +- qase-newman/changelog.md | 7 +++++++ qase-newman/package.json | 2 +- qase-newman/src/reporter.ts | 1 - qase-playwright/src/reporter.ts | 31 +++++-------------------------- qase-testcafe/changelog.md | 7 +++++++ qase-testcafe/package.json | 2 +- qase-testcafe/src/reporter.ts | 14 +++++--------- 16 files changed, 53 insertions(+), 44 deletions(-) diff --git a/qase-cucumberjs/changelog.md b/qase-cucumberjs/changelog.md index 24d9f46c..a3fa2029 100644 --- a/qase-cucumberjs/changelog.md +++ b/qase-cucumberjs/changelog.md @@ -1,3 +1,10 @@ +# qase-cucumberjs@2.0.1 + +## What's new + +Improve the collecting information about failed tests. +Now, the reporter will collect the stack trace and the error message from all errors for failed tests. + # qase-cucumberjs@2.0.0 ## What's new diff --git a/qase-cucumberjs/package.json b/qase-cucumberjs/package.json index 9924c5e1..6b240e47 100644 --- a/qase-cucumberjs/package.json +++ b/qase-cucumberjs/package.json @@ -1,6 +1,6 @@ { "name": "cucumberjs-qase-reporter", - "version": "2.0.0", + "version": "2.0.1", "description": "Qase TMS CucumberJS Reporter", "homepage": "https://github.com/qase-tms/qase-javascript", "main": "./dist/index.js", diff --git a/qase-cucumberjs/src/storage.ts b/qase-cucumberjs/src/storage.ts index bfcc1639..2056cae7 100644 --- a/qase-cucumberjs/src/storage.ts +++ b/qase-cucumberjs/src/storage.ts @@ -225,7 +225,7 @@ export class Storage { start_time: null, end_time: null, duration: Math.abs(testCase.timestamp.seconds - tcs.timestamp.seconds), - stacktrace: error?.stack ?? null, + stacktrace: error?.message ?? null, thread: null, }, fields: metadata.fields, diff --git a/qase-cypress/changelog.md b/qase-cypress/changelog.md index 9ab7e27f..3a4fba0a 100644 --- a/qase-cypress/changelog.md +++ b/qase-cypress/changelog.md @@ -1,3 +1,10 @@ +# cypress-qase-reporter@2.0.3 + +## What's new + +Improve the collecting information about failed tests. +Now, the reporter will collect the stack trace and the error message from all errors for failed tests. + # cypress-qase-reporter@2.0.2 ## What's new diff --git a/qase-cypress/package.json b/qase-cypress/package.json index cf2fb107..c558ad63 100644 --- a/qase-cypress/package.json +++ b/qase-cypress/package.json @@ -1,6 +1,6 @@ { "name": "cypress-qase-reporter", - "version": "2.0.2", + "version": "2.0.3", "description": "Qase Cypress Reporter", "homepage": "https://github.com/qase-tms/qase-javascript", "sideEffects": false, diff --git a/qase-cypress/src/reporter.ts b/qase-cypress/src/reporter.ts index 1def1e35..cd815dab 100644 --- a/qase-cypress/src/reporter.ts +++ b/qase-cypress/src/reporter.ts @@ -189,7 +189,7 @@ export class CypressQaseReporter extends reporters.Base { attachments: attachments ?? [], author: null, fields: {}, - message: test.err?.message ?? null, + message: null, muted: false, params: {}, relations: relations, diff --git a/qase-jest/changelog.md b/qase-jest/changelog.md index 6c1baf6e..7d5fc9a2 100644 --- a/qase-jest/changelog.md +++ b/qase-jest/changelog.md @@ -1,3 +1,10 @@ +# jest-qase-reporter@2.0.2 + +## What's new + +Improve the collecting information about failed tests. +Now, the reporter will collect the stack trace and the error message from all errors for failed tests. + # jest-qase-reporter@2.0.1 ## What's new diff --git a/qase-jest/package.json b/qase-jest/package.json index 62735a27..da4a4222 100644 --- a/qase-jest/package.json +++ b/qase-jest/package.json @@ -1,6 +1,6 @@ { "name": "jest-qase-reporter", - "version": "2.0.1", + "version": "2.0.2", "description": "Qase TMS Jest Reporter", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/qase-jest/src/reporter.ts b/qase-jest/src/reporter.ts index 5aa8c01e..e0835e64 100644 --- a/qase-jest/src/reporter.ts +++ b/qase-jest/src/reporter.ts @@ -130,7 +130,7 @@ export class JestQaseReporter implements Reporter { thread: null, }, fields: {}, - message: error?.message ?? null, + message: null, muted: false, params: {}, relations: this.getRelations(filePath, ancestorTitles), diff --git a/qase-newman/changelog.md b/qase-newman/changelog.md index 6c80dd64..fc52a5b8 100644 --- a/qase-newman/changelog.md +++ b/qase-newman/changelog.md @@ -1,3 +1,10 @@ +# qase-newman@2.0.1 + +## What's new + +Improve the collecting information about failed tests. +Now, the reporter will collect the stack trace and the error message from all errors for failed tests. + # qase-newman@2.0.0 ## What's new diff --git a/qase-newman/package.json b/qase-newman/package.json index da18e6c9..768bdb87 100644 --- a/qase-newman/package.json +++ b/qase-newman/package.json @@ -1,6 +1,6 @@ { "name": "newman-reporter-qase", - "version": "2.0.0", + "version": "2.0.1", "description": "Qase TMS Newman Reporter", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/qase-newman/src/reporter.ts b/qase-newman/src/reporter.ts index 40230f1c..661966a0 100644 --- a/qase-newman/src/reporter.ts +++ b/qase-newman/src/reporter.ts @@ -181,7 +181,6 @@ export class NewmanQaseReporter { pendingResult.execution.status = TestStatusEnum.failed; pendingResult.execution.stacktrace = err.stack ?? null; - pendingResult.message = err.message; } }, ); diff --git a/qase-playwright/src/reporter.ts b/qase-playwright/src/reporter.ts index 52281f4d..7f81ee19 100644 --- a/qase-playwright/src/reporter.ts +++ b/qase-playwright/src/reporter.ts @@ -211,28 +211,19 @@ export class PlaywrightQaseReporter implements Reporter { /** * @param {TestError[]} testErrors - * @returns {Error} + * @returns {string} * @private */ - private static transformError(testErrors: TestError[]): Error { - + private static transformError(testErrors: TestError[]): string { let message = ''; - for (const error of testErrors) { - if (error.message == undefined) { - continue; - } - message += error.message + '\n\n'; - } - - const error = new Error(message); for (const error of testErrors) { if (error.stack == undefined) { continue; } - error.stack += error.stack + '\n\n'; + message += error.stack + '\n\n'; } - return error; + return message; } /** @@ -339,16 +330,6 @@ export class PlaywrightQaseReporter implements Reporter { message = testCaseMetadata.comment; } - if (error) { - if (message) { - message += '\n\n'; - } else { - message = ''; - } - - message += error.message; - } - const testResult: TestResultType = { attachments: testCaseMetadata.attachments, author: null, @@ -357,9 +338,7 @@ export class PlaywrightQaseReporter implements Reporter { start_time: result.startTime.valueOf() / 1000, end_time: null, duration: result.duration, - stacktrace: error === null ? - null : error.stack === undefined ? - null : error.stack, + stacktrace: error, thread: result.parallelIndex.toString(), }, fields: testCaseMetadata.fields, diff --git a/qase-testcafe/changelog.md b/qase-testcafe/changelog.md index e8eb3854..043189c5 100644 --- a/qase-testcafe/changelog.md +++ b/qase-testcafe/changelog.md @@ -1,3 +1,10 @@ +# qase-testcafe@2.0.1 + +## What's new + +Improve the collecting information about failed tests. +Now, the reporter will collect the stack trace and the error message from all errors for failed tests. + # qase-testcafe@2.0.0 ## What's new diff --git a/qase-testcafe/package.json b/qase-testcafe/package.json index 76522a4a..23d40f61 100644 --- a/qase-testcafe/package.json +++ b/qase-testcafe/package.json @@ -1,6 +1,6 @@ { "name": "testcafe-reporter-qase", - "version": "2.0.0", + "version": "2.0.1", "description": "Qase TMS TestCafe Reporter", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/qase-testcafe/src/reporter.ts b/qase-testcafe/src/reporter.ts index dbfe23ab..8f5d7a35 100644 --- a/qase-testcafe/src/reporter.ts +++ b/qase-testcafe/src/reporter.ts @@ -96,10 +96,10 @@ export class TestcafeQaseReporter { /** * @param {TestRunErrorFormattableAdapterType[]} errors - * @returns {Error} + * @returns {string} * @private */ - private static transformErrors(errors: TestRunErrorFormattableAdapterType[]): Error { + private static transformErrors(errors: TestRunErrorFormattableAdapterType[]): string { const [errorMessages, errorStacks] = errors.reduce<[string[], string[]]>( ([messages, stacks], error) => { const stack = @@ -113,11 +113,7 @@ export class TestcafeQaseReporter { [[], []], ); - const error = new Error(errorMessages.join('\n\n')); - - error.stack = errorStacks.join('\n\n'); - - return error; + return errorMessages.join('\n\n') + '\n\n' + errorStacks.join('\n\n'); } /** @@ -192,11 +188,11 @@ export class TestcafeQaseReporter { start_time: null, end_time: null, duration: testRunInfo.durationMs, - stacktrace: error.stack ?? null, + stacktrace: error, thread: null, }, fields: metadata[metadataEnum.fields], - message: error.message, + message: null, muted: false, params: metadata[metadataEnum.parameters], relations: {