playwright-ctrf-json-reporter 0.0.19 → 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
@@ -128,6 +128,8 @@ reporter: [
128
128
 
129
129
  A comprehensive report is generated by default, with the exception of screenshots, which you must explicitly set to true.
130
130
 
131
+ To disable stdio use Playwright built in `quiet` configuration option.
132
+
131
133
  ## Merge reports
132
134
 
133
135
  When running tests in parallel, each test shard has its own test report. If you want to have a combined report showing all the test results from all the shards, you can merge them.
@@ -156,6 +158,7 @@ The test object in the report includes the following [CTRF properties](https://c
156
158
  | `suite` | String | Optional | The suite or group to which the test belongs. |
157
159
  | `message` | String | Optional | The failure message if the test failed. |
158
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. |
159
162
  | `rawStatus` | String | Optional | The original playwright status of the test before mapping to CTRF status. |
160
163
  | `tags` | Array of Strings | Optional | The tags retrieved from the test name |
161
164
  | `type` | String | Optional | The type of test (e.g., `api`, `e2e`). |
@@ -167,7 +170,6 @@ The test object in the report includes the following [CTRF properties](https://c
167
170
  | `stdout` | Array of Strings | Optional | The standard output of the test. |
168
171
  | `stderr` | Array of Strings | Optional | The standard error of the test. |
169
172
  | `screenshot` | String | Optional | A base64 encoded screenshot taken during the test. |
170
- | `screenshot` | String | Optional | A base64 encoded screenshot taken during the test. |
171
173
  | `steps` | Array of Objects | Optional | Individual steps in the test, especially for BDD-style testing. |
172
174
 
173
175
  ## Advanced usage
@@ -32,6 +32,7 @@ declare class GenerateCtrfReport implements Reporter {
32
32
  constructor(config?: Partial<ReporterConfigOptions>);
33
33
  onBegin(_config: FullConfig, suite: Suite): void;
34
34
  onEnd(): void;
35
+ printsToStdio(): boolean;
35
36
  processSuite(suite: Suite): void;
36
37
  processTest(testCase: TestCase): void;
37
38
  setFilename(filename: string): void;
@@ -75,6 +75,9 @@ class GenerateCtrfReport {
75
75
  }
76
76
  this.writeReportToFile(this.ctrfReport);
77
77
  }
78
+ printsToStdio() {
79
+ return false;
80
+ }
78
81
  processSuite(suite) {
79
82
  for (const test of suite.tests) {
80
83
  this.processTest(test);
@@ -113,6 +116,7 @@ class GenerateCtrfReport {
113
116
  test.stop = this.calculateStopTime(testResult.startTime, testResult.duration);
114
117
  test.message = this.extractFailureDetails(testResult).message;
115
118
  test.trace = this.extractFailureDetails(testResult).trace;
119
+ test.snippet = this.extractFailureDetails(testResult).snippet;
116
120
  test.rawStatus = testResult.status;
117
121
  test.tags = this.extractTagsFromTitle(testCase.title);
118
122
  test.type = (_a = this.reporterConfigOptions.testType) !== null && _a !== void 0 ? _a : 'e2e';
@@ -273,6 +277,9 @@ class GenerateCtrfReport {
273
277
  if (testResult.error.stack !== undefined) {
274
278
  failureDetails.trace = testResult.error.stack;
275
279
  }
280
+ if (testResult.error.snippet !== undefined) {
281
+ failureDetails.snippet = testResult.error.snippet;
282
+ }
276
283
  return failureDetails;
277
284
  }
278
285
  return {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-ctrf-json-reporter",
3
- "version": "0.0.19",
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": {