Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: improve a stack trace handling #658

Merged
merged 2 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
172 changes: 5 additions & 167 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions qase-playwright/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [email protected]

## What's new

Improved stack trace handling when an error occurs.
Now, records related to the reporter are not added to the stack trace.

# [email protected]

## What's new
Expand Down
4 changes: 2 additions & 2 deletions qase-playwright/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
16 changes: 8 additions & 8 deletions qase-playwright/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as path from 'path';
import {
Attachment,
composeOptions,
CompoundError,
ConfigLoader,
ConfigType,
QaseReporter,
Expand Down Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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,
Expand Down
Loading