From 9bc0c82fc36bfea21372597948921cbd8d022408 Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Wed, 14 Aug 2024 15:58:56 +0200 Subject: [PATCH 1/2] feature: improve a stack trace handling Improved stack trace handling when an error occurs. Now, records related to the reporter are not added to the stack trace. --- qase-playwright/changelog.md | 7 +++++++ qase-playwright/package.json | 4 ++-- qase-playwright/src/reporter.ts | 16 ++++++++-------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/qase-playwright/changelog.md b/qase-playwright/changelog.md index 4233f871..7e13a861 100644 --- a/qase-playwright/changelog.md +++ b/qase-playwright/changelog.md @@ -1,3 +1,10 @@ +# playwright-qase-reporter@2.0.10 + +## What's new + +Improved stack trace handling when an error occurs. +Now, records related to the reporter are not added to the stack trace. + # playwright-qase-reporter@2.0.9 ## What's new diff --git a/qase-playwright/package.json b/qase-playwright/package.json index 1418dc0c..54f49ef6 100644 --- a/qase-playwright/package.json +++ b/qase-playwright/package.json @@ -1,6 +1,6 @@ { "name": "playwright-qase-reporter", - "version": "2.0.9", + "version": "2.0.10", "description": "Qase TMS Playwright Reporter", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -44,7 +44,7 @@ "license": "Apache-2.0", "dependencies": { "chalk": "^4.1.2", - "qase-javascript-commons": "^2.0.8", + "qase-javascript-commons": "~2.1.1", "uuid": "^9.0.0" }, "peerDependencies": { diff --git a/qase-playwright/src/reporter.ts b/qase-playwright/src/reporter.ts index 0fafe46a..0a00affd 100644 --- a/qase-playwright/src/reporter.ts +++ b/qase-playwright/src/reporter.ts @@ -6,6 +6,7 @@ import * as path from 'path'; import { Attachment, composeOptions, + CompoundError, ConfigLoader, ConfigType, QaseReporter, @@ -214,25 +215,24 @@ export class PlaywrightQaseReporter implements Reporter { * @returns {Error} * @private */ - private static transformError(testErrors: TestError[]): Error { + private static transformError(testErrors: TestError[]): CompoundError { + const compoundError = new CompoundError(); - let message = ''; for (const error of testErrors) { if (error.message == undefined) { continue; } - message += error.message + '\n\n'; + compoundError.addMessage(error.message); } - const error = new Error(message); for (const error of testErrors) { if (error.stack == undefined) { continue; } - error.stack += error.stack + '\n\n'; + compoundError.addStacktrace(error.stack); } - return error; + return compoundError; } /** @@ -360,8 +360,8 @@ export class PlaywrightQaseReporter implements Reporter { end_time: null, duration: result.duration, stacktrace: error === null ? - null : error.stack === undefined ? - null : error.stack, + null : error.stacktrace === undefined ? + null : error.stacktrace, thread: result.parallelIndex.toString(), }, fields: testCaseMetadata.fields, From 5c86bdd0f2fdb264b6be1251be30aa07411a9ed6 Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Wed, 14 Aug 2024 16:59:54 +0200 Subject: [PATCH 2/2] update package-lock.json --- package-lock.json | 172 ++-------------------------------------------- 1 file changed, 5 insertions(+), 167 deletions(-) diff --git a/package-lock.json b/package-lock.json index 38139ee6..99baf877 100644 --- a/package-lock.json +++ b/package-lock.json @@ -72,30 +72,6 @@ "cypress": ">=8.0.0" } }, - "examples/cypress/node_modules/qase-javascript-commons": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/qase-javascript-commons/-/qase-javascript-commons-2.0.13.tgz", - "integrity": "sha512-ER+q5kTrevo8jKzoHPDeFUOzdDt7ZLqL1ek6Py6oGlR5VnJRZegSt/BfJvXhbFcn2PLa5si/vaNSr/rnGhbF8Q==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "ajv": "^8.12.0", - "chalk": "^4.1.2", - "child-process-ext": "^3.0.2", - "env-schema": "^5.2.0", - "form-data": "^4.0.0", - "lodash.get": "^4.4.2", - "lodash.merge": "^4.6.2", - "lodash.mergewith": "^4.6.2", - "mime-types": "^2.1.33", - "qaseio": "~2.2.0", - "strip-ansi": "^6.0.1", - "uuid": "^9.0.0" - }, - "engines": { - "node": ">=14" - } - }, "examples/jest": { "name": "examples-jest", "devDependencies": { @@ -15102,35 +15078,12 @@ "@cucumber/cucumber": ">=7.0.0" } }, - "qase-cucumberjs/node_modules/qase-javascript-commons": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/qase-javascript-commons/-/qase-javascript-commons-2.0.13.tgz", - "integrity": "sha512-ER+q5kTrevo8jKzoHPDeFUOzdDt7ZLqL1ek6Py6oGlR5VnJRZegSt/BfJvXhbFcn2PLa5si/vaNSr/rnGhbF8Q==", - "license": "Apache-2.0", - "dependencies": { - "ajv": "^8.12.0", - "chalk": "^4.1.2", - "child-process-ext": "^3.0.2", - "env-schema": "^5.2.0", - "form-data": "^4.0.0", - "lodash.get": "^4.4.2", - "lodash.merge": "^4.6.2", - "lodash.mergewith": "^4.6.2", - "mime-types": "^2.1.33", - "qaseio": "~2.2.0", - "strip-ansi": "^6.0.1", - "uuid": "^9.0.0" - }, - "engines": { - "node": ">=14" - } - }, "qase-cypress": { "name": "cypress-qase-reporter", - "version": "2.1.0-beta.1", + "version": "2.1.0", "license": "Apache-2.0", "dependencies": { - "qase-javascript-commons": "~2.1.0-beta.1", + "qase-javascript-commons": "~2.1.0", "uuid": "^9.0.1" }, "devDependencies": { @@ -15150,7 +15103,7 @@ } }, "qase-javascript-commons": { - "version": "2.1.0-beta.1", + "version": "2.1.1", "license": "Apache-2.0", "dependencies": { "ajv": "^8.12.0", @@ -15227,29 +15180,6 @@ "jest": ">=28.0.0" } }, - "qase-jest/node_modules/qase-javascript-commons": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/qase-javascript-commons/-/qase-javascript-commons-2.0.13.tgz", - "integrity": "sha512-ER+q5kTrevo8jKzoHPDeFUOzdDt7ZLqL1ek6Py6oGlR5VnJRZegSt/BfJvXhbFcn2PLa5si/vaNSr/rnGhbF8Q==", - "license": "Apache-2.0", - "dependencies": { - "ajv": "^8.12.0", - "chalk": "^4.1.2", - "child-process-ext": "^3.0.2", - "env-schema": "^5.2.0", - "form-data": "^4.0.0", - "lodash.get": "^4.4.2", - "lodash.merge": "^4.6.2", - "lodash.mergewith": "^4.6.2", - "mime-types": "^2.1.33", - "qaseio": "~2.2.0", - "strip-ansi": "^6.0.1", - "uuid": "^9.0.0" - }, - "engines": { - "node": ">=14" - } - }, "qase-mocha": { "name": "mocha-qase-reporter", "version": "1.0.0-beta.2", @@ -15284,29 +15214,6 @@ "undici-types": "~5.26.4" } }, - "qase-mocha/node_modules/qase-javascript-commons": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/qase-javascript-commons/-/qase-javascript-commons-2.0.13.tgz", - "integrity": "sha512-ER+q5kTrevo8jKzoHPDeFUOzdDt7ZLqL1ek6Py6oGlR5VnJRZegSt/BfJvXhbFcn2PLa5si/vaNSr/rnGhbF8Q==", - "license": "Apache-2.0", - "dependencies": { - "ajv": "^8.12.0", - "chalk": "^4.1.2", - "child-process-ext": "^3.0.2", - "env-schema": "^5.2.0", - "form-data": "^4.0.0", - "lodash.get": "^4.4.2", - "lodash.merge": "^4.6.2", - "lodash.mergewith": "^4.6.2", - "mime-types": "^2.1.33", - "qaseio": "~2.2.0", - "strip-ansi": "^6.0.1", - "uuid": "^9.0.0" - }, - "engines": { - "node": ">=14" - } - }, "qase-newman": { "name": "newman-reporter-qase", "version": "2.0.0", @@ -15331,36 +15238,13 @@ "newman": ">=5.3.0" } }, - "qase-newman/node_modules/qase-javascript-commons": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/qase-javascript-commons/-/qase-javascript-commons-2.0.13.tgz", - "integrity": "sha512-ER+q5kTrevo8jKzoHPDeFUOzdDt7ZLqL1ek6Py6oGlR5VnJRZegSt/BfJvXhbFcn2PLa5si/vaNSr/rnGhbF8Q==", - "license": "Apache-2.0", - "dependencies": { - "ajv": "^8.12.0", - "chalk": "^4.1.2", - "child-process-ext": "^3.0.2", - "env-schema": "^5.2.0", - "form-data": "^4.0.0", - "lodash.get": "^4.4.2", - "lodash.merge": "^4.6.2", - "lodash.mergewith": "^4.6.2", - "mime-types": "^2.1.33", - "qaseio": "~2.2.0", - "strip-ansi": "^6.0.1", - "uuid": "^9.0.0" - }, - "engines": { - "node": ">=14" - } - }, "qase-playwright": { "name": "playwright-qase-reporter", - "version": "2.0.6", + "version": "2.0.10", "license": "Apache-2.0", "dependencies": { "chalk": "^4.1.2", - "qase-javascript-commons": "^2.0.8", + "qase-javascript-commons": "~2.1.1", "uuid": "^9.0.0" }, "devDependencies": { @@ -15376,29 +15260,6 @@ "@playwright/test": ">=1.16.3" } }, - "qase-playwright/node_modules/qase-javascript-commons": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/qase-javascript-commons/-/qase-javascript-commons-2.0.13.tgz", - "integrity": "sha512-ER+q5kTrevo8jKzoHPDeFUOzdDt7ZLqL1ek6Py6oGlR5VnJRZegSt/BfJvXhbFcn2PLa5si/vaNSr/rnGhbF8Q==", - "license": "Apache-2.0", - "dependencies": { - "ajv": "^8.12.0", - "chalk": "^4.1.2", - "child-process-ext": "^3.0.2", - "env-schema": "^5.2.0", - "form-data": "^4.0.0", - "lodash.get": "^4.4.2", - "lodash.merge": "^4.6.2", - "lodash.mergewith": "^4.6.2", - "mime-types": "^2.1.33", - "qaseio": "~2.2.0", - "strip-ansi": "^6.0.1", - "uuid": "^9.0.0" - }, - "engines": { - "node": ">=14" - } - }, "qase-testcafe": { "name": "testcafe-reporter-qase", "version": "2.0.0", @@ -15420,29 +15281,6 @@ "testcafe": ">=2.0.0" } }, - "qase-testcafe/node_modules/qase-javascript-commons": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/qase-javascript-commons/-/qase-javascript-commons-2.0.13.tgz", - "integrity": "sha512-ER+q5kTrevo8jKzoHPDeFUOzdDt7ZLqL1ek6Py6oGlR5VnJRZegSt/BfJvXhbFcn2PLa5si/vaNSr/rnGhbF8Q==", - "license": "Apache-2.0", - "dependencies": { - "ajv": "^8.12.0", - "chalk": "^4.1.2", - "child-process-ext": "^3.0.2", - "env-schema": "^5.2.0", - "form-data": "^4.0.0", - "lodash.get": "^4.4.2", - "lodash.merge": "^4.6.2", - "lodash.mergewith": "^4.6.2", - "mime-types": "^2.1.33", - "qaseio": "~2.2.0", - "strip-ansi": "^6.0.1", - "uuid": "^9.0.0" - }, - "engines": { - "node": ">=14" - } - }, "qaseio": { "version": "2.2.0", "license": "Apache-2.0",