playwright-ctrf-json-reporter 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -158,6 +158,7 @@ The test object in the report includes the following [CTRF properties](https://c
158
158
  | `suite` | String | Optional | The suite or group to which the test belongs. |
159
159
  | `message` | String | Optional | The failure message if the test failed. |
160
160
  | `trace` | String | Optional | The stack trace captured if the test failed. |
161
+ | `snippet` | String | Optional | The code snippet that was executed during the test if the test failed. |
161
162
  | `rawStatus` | String | Optional | The original playwright status of the test before mapping to CTRF status. |
162
163
  | `tags` | Array of Strings | Optional | The tags retrieved from the test name |
163
164
  | `type` | String | Optional | The type of test (e.g., `api`, `e2e`). |
@@ -169,7 +170,6 @@ The test object in the report includes the following [CTRF properties](https://c
169
170
  | `stdout` | Array of Strings | Optional | The standard output of the test. |
170
171
  | `stderr` | Array of Strings | Optional | The standard error of the test. |
171
172
  | `screenshot` | String | Optional | A base64 encoded screenshot taken during the test. |
172
- | `screenshot` | String | Optional | A base64 encoded screenshot taken during the test. |
173
173
  | `steps` | Array of Objects | Optional | Individual steps in the test, especially for BDD-style testing. |
174
174
 
175
175
  ## Advanced usage
@@ -116,6 +116,7 @@ class GenerateCtrfReport {
116
116
  test.stop = this.calculateStopTime(testResult.startTime, testResult.duration);
117
117
  test.message = this.extractFailureDetails(testResult).message;
118
118
  test.trace = this.extractFailureDetails(testResult).trace;
119
+ test.snippet = this.extractFailureDetails(testResult).snippet;
119
120
  test.rawStatus = testResult.status;
120
121
  test.tags = this.extractTagsFromTitle(testCase.title);
121
122
  test.type = (_a = this.reporterConfigOptions.testType) !== null && _a !== void 0 ? _a : 'e2e';
@@ -276,6 +277,9 @@ class GenerateCtrfReport {
276
277
  if (testResult.error.stack !== undefined) {
277
278
  failureDetails.trace = testResult.error.stack;
278
279
  }
280
+ if (testResult.error.snippet !== undefined) {
281
+ failureDetails.snippet = testResult.error.snippet;
282
+ }
279
283
  return failureDetails;
280
284
  }
281
285
  return {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-ctrf-json-reporter",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "A Playwright JSON test reporter to create test results reports",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {