@flakiness/cucumberjs 1.1.0 → 1.1.1
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 +10 -2
- package/lib/formatter.js +13 -7
- package/package.json +1 -1
- package/types/src/formatter.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -55,7 +55,10 @@ Add the formatter to your `cucumber.mjs`:
|
|
|
55
55
|
export default {
|
|
56
56
|
paths: ['features/**/*.feature'],
|
|
57
57
|
import: ['features/support/**/*.ts'],
|
|
58
|
-
format: [
|
|
58
|
+
format: [
|
|
59
|
+
'progress',
|
|
60
|
+
['@flakiness/cucumberjs', '.flakiness/cucumber-formatter.log'],
|
|
61
|
+
],
|
|
59
62
|
formatOptions: {
|
|
60
63
|
flakinessProject: 'my-org/my-project',
|
|
61
64
|
},
|
|
@@ -83,6 +86,8 @@ Reports are automatically uploaded to Flakiness.io after test completion. Authen
|
|
|
83
86
|
|
|
84
87
|
If upload fails, the report is still available locally in the output folder.
|
|
85
88
|
|
|
89
|
+
If you combine this formatter with a progress formatter, keep the progress formatter on `stdout` and redirect `@flakiness/cucumberjs` to a file as shown above. Upload status messages are printed to `stderr`, so the uploaded report URL stays visible in the terminal.
|
|
90
|
+
|
|
86
91
|
## Viewing Reports
|
|
87
92
|
|
|
88
93
|
After test execution, you can view the report using:
|
|
@@ -189,7 +194,10 @@ Here's a complete example with all options:
|
|
|
189
194
|
export default {
|
|
190
195
|
paths: ['features/**/*.feature'],
|
|
191
196
|
import: ['features/support/**/*.ts'],
|
|
192
|
-
format: [
|
|
197
|
+
format: [
|
|
198
|
+
'progress',
|
|
199
|
+
['@flakiness/cucumberjs', '.flakiness/cucumber-formatter.log'],
|
|
200
|
+
],
|
|
193
201
|
formatOptions: {
|
|
194
202
|
flakinessProject: 'my-org/my-project',
|
|
195
203
|
endpoint: process.env.FLAKINESS_ENDPOINT,
|
package/lib/formatter.js
CHANGED
|
@@ -13,6 +13,11 @@ import {
|
|
|
13
13
|
import fs from "node:fs";
|
|
14
14
|
import path from "node:path";
|
|
15
15
|
const CUCUMBER_LOG_MEDIA_TYPE = "text/x.cucumber.log+plain";
|
|
16
|
+
const STDERR_LOGGER = {
|
|
17
|
+
log: (...args) => console.error(...args),
|
|
18
|
+
warn: (...args) => console.error(...args),
|
|
19
|
+
error: (...args) => console.error(...args)
|
|
20
|
+
};
|
|
16
21
|
class FlakinessCucumberFormatter extends Formatter {
|
|
17
22
|
static documentation = "Generates a Flakiness report for a CucumberJS run.";
|
|
18
23
|
_config;
|
|
@@ -98,19 +103,20 @@ class FlakinessCucumberFormatter extends Formatter {
|
|
|
98
103
|
this._cpuUtilization.enrich(report);
|
|
99
104
|
this._ramUtilization.enrich(report);
|
|
100
105
|
await writeReport(report, attachments, this._outputFolder);
|
|
106
|
+
const command = showReportCommand(this._outputFolder);
|
|
107
|
+
console.error(`
|
|
108
|
+
To open last Flakiness report, run:
|
|
109
|
+
|
|
110
|
+
${command}
|
|
111
|
+
`);
|
|
101
112
|
const disableUpload = this._config.disableUpload ?? envBool("FLAKINESS_DISABLE_UPLOAD");
|
|
102
113
|
if (!disableUpload) {
|
|
103
114
|
await uploadReport(report, attachments, {
|
|
104
115
|
flakinessAccessToken: this._config.token,
|
|
105
|
-
flakinessEndpoint: this._config.endpoint
|
|
116
|
+
flakinessEndpoint: this._config.endpoint,
|
|
117
|
+
logger: STDERR_LOGGER
|
|
106
118
|
});
|
|
107
119
|
}
|
|
108
|
-
const command = showReportCommand(this._outputFolder);
|
|
109
|
-
this.log(`
|
|
110
|
-
To open last Flakiness report, run:
|
|
111
|
-
|
|
112
|
-
${command}
|
|
113
|
-
`);
|
|
114
120
|
}
|
|
115
121
|
async _collectSuites(worktree) {
|
|
116
122
|
const suitesByKey = /* @__PURE__ */ new Map();
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAoB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAoB,MAAM,oBAAoB,CAAC;AAuDjE,MAAM,CAAC,OAAO,OAAO,0BAA2B,SAAQ,SAAS;IAC/D,MAAM,CAAC,aAAa,SAAwD;IAE5E,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,eAAe,CAAyC;IAChE,OAAO,CAAC,eAAe,CAAyC;IAChE,OAAO,CAAC,eAAe,CAAoC;IAC3D,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,eAAe,CAAC,CAAiB;IAEzC,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,oBAAoB,CAAsC;IAClE,OAAO,CAAC,qBAAqB,CAAuC;gBAExD,OAAO,EAAE,iBAAiB;IA0BtC,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,mBAAmB;IAIZ,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAaxC,OAAO,CAAC,aAAa;YAMP,kBAAkB;YAqDlB,cAAc;CA4F7B"}
|