@dev-blinq/cucumber-js 1.0.122 → 1.0.123-stage

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.
@@ -19,7 +19,14 @@ declare class RunUploadService {
19
19
  updateProjectAnalytics(projectId: string): Promise<void>;
20
20
  upload(formData: FormData): Promise<void>;
21
21
  getPreSignedUrls(fileUris: string[], runId: string): Promise<any>;
22
- uploadTestCase(testCaseReport: JsonTestProgress, runId: string, projectId: string, reportFolder: string, rerunId?: string): Promise<FinishTestCaseResponse>;
22
+ uploadTestCase(testCaseReport: JsonTestProgress, runId: string, projectId: string, reportFolder: string, rerunId?: string): Promise<any>;
23
+ /**
24
+ * Improving error logging
25
+ * 🔧 Sanitizes Axios errors to avoid dumping Cloudflare HTML (524, 502, etc.)
26
+ */
27
+ private sanitizeError;
28
+ uploadFileWithRetries(filePath: string, presignedUrl: string): Promise<boolean>;
29
+ uploadFilesInBatches(fileUris: string[], reportFolder: string, preSignedUrls: Record<string, string>): Promise<void>;
23
30
  uploadFile(filePath: string, preSignedUrl: string): Promise<boolean>;
24
31
  uploadComplete(runId: string, projectId: string): Promise<void>;
25
32
  modifyTestCase(runId: string, projectId: string, testProgressReport: JsonTestProgress): Promise<void>;
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.RunUploadService = void 0;
8
8
  const fs_1 = require("fs");
9
9
  const promises_1 = __importDefault(require("fs/promises"));
10
+ const p_limit_1 = __importDefault(require("p-limit"));
10
11
  const axios_client_1 = require("../../configuration/axios_client");
11
12
  const path_1 = __importDefault(require("path"));
12
13
  const bvt_analysis_formatter_1 = require("../bvt_analysis_formatter");
@@ -125,98 +126,141 @@ class RunUploadService {
125
126
  return response.data.uploadUrls;
126
127
  }
127
128
  async uploadTestCase(testCaseReport, runId, projectId, reportFolder, rerunId) {
128
- if (process.env.UPLOADREPORTS === 'false') {
129
+ var _a, _b, _c, _d;
130
+ if (process.env.UPLOADREPORTS === 'false')
129
131
  return null;
130
- }
131
132
  const fileUris = [];
132
- //iterate over all the files in the JsonCommand.screenshotId and insert them into the fileUris array
133
+ // Collect screenshot + trace + logs
133
134
  for (const step of testCaseReport.steps) {
134
135
  for (const command of step.commands) {
135
- if (command.screenshotId) {
136
- fileUris.push('screenshots' + '/' + String(command.screenshotId) + '.png');
137
- }
138
- }
139
- if (step.traceFilePath) {
140
- fileUris.push('trace' + '/' + step.traceFilePath);
136
+ if (command.screenshotId)
137
+ fileUris.push(`screenshots/${command.screenshotId}.png`);
141
138
  }
139
+ if (step.traceFilePath)
140
+ fileUris.push(`trace/${step.traceFilePath}`);
141
+ }
142
+ if (testCaseReport.logFileId)
143
+ fileUris.push(`editorLogs/testCaseLog_${testCaseReport.logFileId}.log`);
144
+ if (testCaseReport.traceFileId)
145
+ fileUris.push(`trace/${testCaseReport.traceFileId}`);
146
+ // 🔹 UPLOAD FILES
147
+ try {
148
+ const preSignedUrls = await this.getPreSignedUrls(fileUris, runId);
149
+ await this.uploadFilesInBatches(fileUris, reportFolder, preSignedUrls);
142
150
  }
143
- if (testCaseReport.logFileId) {
144
- fileUris.push('editorLogs' + '/' + 'testCaseLog_' + testCaseReport.logFileId + '.log');
151
+ catch (error) {
152
+ console.error('🟥 Error uploading files:', {
153
+ message: error === null || error === void 0 ? void 0 : error.message,
154
+ stack: error === null || error === void 0 ? void 0 : error.stack,
155
+ });
145
156
  }
146
- // console.log({ fileUris })
147
- const preSignedUrls = await this.getPreSignedUrls(fileUris, runId);
148
- //upload all the files in the fileUris array
157
+ // 🔹 UPLOAD FINAL TEST REPORT
149
158
  try {
150
- for (let i = 0; i < fileUris.length; i += BATCH_SIZE) {
151
- const batch = fileUris.slice(i, Math.min(i + BATCH_SIZE, fileUris.length));
152
- await Promise.all(batch
153
- .filter((fileUri) => preSignedUrls[fileUri])
154
- .map(async (fileUri) => {
155
- for (let j = 0; j < MAX_RETRIES; j++) {
156
- if ((0, fs_1.existsSync)(path_1.default.join(reportFolder, fileUri))) {
157
- const success = await this.uploadFile(path_1.default.join(reportFolder, fileUri), preSignedUrls[fileUri]);
158
- if (success) {
159
- return;
160
- }
161
- }
162
- const success = await this.uploadFile(path_1.default.join(reportFolder, fileUri), preSignedUrls[fileUri]);
163
- if (success) {
164
- return;
165
- }
166
- }
167
- console.error('Failed to upload file:', fileUri);
168
- }));
169
- }
170
- // writeFileSync("report.json", JSON.stringify(testCaseReport, null, 2))
171
159
  const mode = process.env.MODE === 'cloud'
172
160
  ? 'cloud'
173
161
  : process.env.MODE === 'executions'
174
162
  ? 'executions'
175
163
  : 'local';
176
- let rerunIdFinal = null;
177
- rerunIdFinal = process.env.RETRY_ID || null;
178
- if (rerunId) {
164
+ let rerunIdFinal = process.env.RETRY_ID || null;
165
+ if (rerunId)
179
166
  rerunIdFinal = rerunId.includes(runId) ? rerunId : `${runId}${rerunId}`;
180
- }
181
- if (mode === 'executions') {
167
+ if (mode === 'executions')
182
168
  testCaseReport.id = process.env.VIDEO_ID || testCaseReport.id;
183
- }
184
- const { data } = await axios_client_1.axiosClient.post(this.runsApiBaseURL + '/cucumber-runs/createNewTestCase', {
169
+ const payload = {
185
170
  runId,
186
171
  projectId,
187
172
  testProgressReport: testCaseReport,
188
- browser: process.env.BROWSER ? process.env.BROWSER : 'chromium',
173
+ browser: process.env.BROWSER || 'chromium',
189
174
  mode,
190
175
  rerunId: rerunIdFinal,
191
176
  video_id: process.env.VIDEO_ID,
192
- }, {
193
- headers: {
194
- Authorization: 'Bearer ' + this.accessToken,
195
- 'x-source': 'cucumber_js',
196
- },
197
- });
198
- try {
199
- await axios_client_1.axiosClient.post(`${constants_1.SERVICES_URI.STORAGE}/event`, {
200
- event: constants_1.ActionEvents.upload_report,
201
- }, {
202
- headers: {
203
- Authorization: 'Bearer ' + this.accessToken,
204
- 'x-source': 'cucumber_js',
205
- 'x-bvt-project-id': projectId,
206
- },
207
- });
208
- }
209
- catch (error) {
210
- // no event tracking
211
- }
177
+ };
178
+ const data = await (0, bvt_analysis_formatter_1.createNewTestCase)(payload, this.runsApiBaseURL, this.accessToken);
179
+ await (0, bvt_analysis_formatter_1.postUploadReportEvent)(projectId, this.accessToken);
212
180
  (0, bvt_analysis_formatter_1.logReportLink)(runId, projectId, testCaseReport.result);
213
181
  return data;
214
182
  }
215
183
  catch (e) {
216
- console.error(`failed to upload the test case: ${testCaseReport.id} ${e}`);
184
+ console.error('🟥 Failed to upload test case:', {
185
+ testCaseId: testCaseReport.id,
186
+ message: e === null || e === void 0 ? void 0 : e.message,
187
+ status: (_a = e === null || e === void 0 ? void 0 : e.response) === null || _a === void 0 ? void 0 : _a.status,
188
+ responseSnippet: (_d = (_c = (_b = e === null || e === void 0 ? void 0 : e.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.toString()) === null || _d === void 0 ? void 0 : _d.slice(0, 300),
189
+ stack: e === null || e === void 0 ? void 0 : e.stack,
190
+ });
217
191
  return null;
218
192
  }
219
193
  }
194
+ /**
195
+ * Improving error logging
196
+ * 🔧 Sanitizes Axios errors to avoid dumping Cloudflare HTML (524, 502, etc.)
197
+ */
198
+ sanitizeError(error) {
199
+ // Handle Axios-style errors with response
200
+ if (error === null || error === void 0 ? void 0 : error.response) {
201
+ const { data, status } = error.response;
202
+ // If Cloudflare or HTML error page → return a short meaningful message
203
+ if (typeof data === 'string' && data.includes('<!DOCTYPE html')) {
204
+ return `[HTML_ERROR_PAGE] status=${status} - likely Cloudflare timeout or proxy error`;
205
+ }
206
+ // If data is a JSON object, stringify it with indentation for readability
207
+ if (typeof data === 'object') {
208
+ return JSON.stringify(data, null, 2); // Pretty-print the JSON response
209
+ }
210
+ // If response is a string (could be an error message), return it trimmed
211
+ return (data === null || data === void 0 ? void 0 : data.trim()) || `Unknown response data (status: ${status})`;
212
+ }
213
+ // System / network errors (e.g., if Axios cannot reach the server)
214
+ if (error === null || error === void 0 ? void 0 : error.message) {
215
+ return error.message;
216
+ }
217
+ // If the error has a stack (for debugging purposes)
218
+ if (error === null || error === void 0 ? void 0 : error.stack) {
219
+ return `${error.message}\n${error.stack}`;
220
+ }
221
+ // If it's a generic error object, attempt to stringify it in a readable format
222
+ return JSON.stringify(error, (key, value) => {
223
+ // Avoid circular references or sensitive data
224
+ if (key === 'password' || key === 'accessToken')
225
+ return '[REDACTED]';
226
+ return value;
227
+ }, 2); // Pretty-print the error object with indentation
228
+ }
229
+ async uploadFileWithRetries(filePath, presignedUrl) {
230
+ const MAX_RETRIES = 3;
231
+ const RETRY_DELAY_MS = 1000;
232
+ for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
233
+ try {
234
+ const ok = await this.uploadFile(filePath, presignedUrl);
235
+ if (ok)
236
+ return true;
237
+ }
238
+ catch (err) {
239
+ console.error(`Upload attempt #${attempt} failed for ${filePath}:`, {
240
+ message: err === null || err === void 0 ? void 0 : err.message,
241
+ stack: err === null || err === void 0 ? void 0 : err.stack,
242
+ });
243
+ if (attempt < MAX_RETRIES) {
244
+ await new Promise((r) => setTimeout(r, RETRY_DELAY_MS * attempt));
245
+ }
246
+ }
247
+ }
248
+ console.error(`Failed to upload file after ${MAX_RETRIES} retries: ${filePath}`);
249
+ return false;
250
+ }
251
+ async uploadFilesInBatches(fileUris, reportFolder, preSignedUrls) {
252
+ const MAX_CONCURRENCY = 5;
253
+ const limit = (0, p_limit_1.default)(MAX_CONCURRENCY);
254
+ const tasks = fileUris
255
+ .filter((uri) => preSignedUrls[uri])
256
+ .map((uri) => limit(async () => {
257
+ const filePath = path_1.default.join(reportFolder, uri);
258
+ if ((0, fs_1.existsSync)(filePath)) {
259
+ await this.uploadFileWithRetries(filePath, preSignedUrls[uri]);
260
+ }
261
+ }));
262
+ await Promise.all(tasks);
263
+ }
220
264
  async uploadFile(filePath, preSignedUrl) {
221
265
  if (process.env.UPLOADREPORTS === 'false') {
222
266
  return true;
@@ -234,8 +278,9 @@ class RunUploadService {
234
278
  });
235
279
  }
236
280
  catch (error) {
237
- if (process.env.NODE_ENV_BLINQ === 'dev') {
238
- console.error('Error uploading file:', error);
281
+ if (process.env.MODE === 'executions') {
282
+ const sanitized = this.sanitizeError(error);
283
+ console.error('❌ Error uploading file at:', filePath, 'due to', sanitized);
239
284
  }
240
285
  success = false;
241
286
  }
@@ -1 +1 @@
1
- {"version":3,"file":"upload_serivce.js","sourceRoot":"","sources":["../../../src/formatter/helpers/upload_serivce.ts"],"names":[],"mappings":";;;;;;;AAEA,2BAAuE;AACvE,2DAA4B;AAG5B,mEAA8D;AAC9D,gDAAuB;AACvB,sEAAyD;AACzD,2CAAwD;AAExD,MAAM,kBAAkB,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,kBAAkB,mCAAI,GAAG,CAAA;AAChE,MAAM,UAAU,GAAG,EAAE,CAAA;AACrB,MAAM,WAAW,GAAG,CAAC,CAAA;AACrB,MAAM,oBAAoB,GACxB,MAAA,OAAO,CAAC,GAAG,CAAC,KAAK,mCAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAA;AAevD,MAAM,gBAAgB;IACpB,YACU,cAAsB,EACtB,WAAmB;QADnB,mBAAc,GAAd,cAAc,CAAQ;QACtB,gBAAW,GAAX,WAAW,CAAQ;IAC1B,CAAC;IACJ,KAAK,CAAC,iBAAiB,CAAC,IAAY,EAAE,GAAQ;QAC5C,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,OAAO,EAAE;YACzC,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAA;YACtE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;SACvD;QACD,IAAI;YACF,MAAM,YAAY,GAAG,MAAM,0BAAW,CAAC,IAAI,CACzC,IAAI,CAAC,cAAc,GAAG,uBAAuB,EAC7C;gBACE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM;gBAC1B,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAA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AAE,IAAI,CAAC,EAAE,CAChE,CAAA;SACF;IACH,CAAC;IACD,KAAK,CAAC,YAAY,CAAC,MAAc;QAC/B,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,OAAO,EAAE;YACzC,OAAM;SACP;QACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE;YACrB,OAAM;SACP;QAED,IAAI;YACF,MAAM,0BAAW,CAAC,IAAI,CACpB,IAAI,CAAC,cAAc,GAAG,mBAAmB,EACzC;gBACE,MAAM,EAAE,EAAE,MAAM,EAAE;gBAClB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;aACvB,EACD;gBACE,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,GAAG,IAAI,CAAC,WAAW;oBAC3C,UAAU,EAAE,aAAa;iBAC1B;aACF,CACF,CAAA;SACF;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAA;SAChE;IACH,CAAC;CACF;AAEQ,4CAAgB","sourcesContent":["/* eslint-disable no-console */\nimport FormData from 'form-data'\nimport { createReadStream, existsSync, write, writeFileSync } from 'fs'\nimport fs from 'fs/promises'\n\nimport { JsonReport, JsonTestProgress } from './report_generator'\nimport { axiosClient } from '../../configuration/axios_client'\nimport path from 'path'\nimport { logReportLink } from '../bvt_analysis_formatter'\nimport { ActionEvents, SERVICES_URI } from './constants'\n\nconst REPORT_SERVICE_URL = process.env.REPORT_SERVICE_URL ?? URL\nconst BATCH_SIZE = 10\nconst MAX_RETRIES = 3\nconst REPORT_SERVICE_TOKEN =\n process.env.TOKEN ?? process.env.REPORT_SERVICE_TOKEN\n\nexport interface RootCauseProps {\n status: boolean\n analysis: string\n failedStep: number\n failClass: string\n}\n\nexport interface FinishTestCaseResponse {\n status: true\n rootCause: RootCauseProps\n report: JsonTestProgress\n}\n\nclass RunUploadService {\n constructor(\n private runsApiBaseURL: string,\n private accessToken: string\n ) {}\n async createRunDocument(name: string, env: any) {\n if (process.env.UPLOADREPORTS === 'false') {\n console.log('Skipping report upload as UPLOADREPORTS is set to false')\n return { id: 'local-run', projectId: 'local-project' }\n }\n try {\n const runDocResult = await axiosClient.post(\n this.runsApiBaseURL + '/cucumber-runs/create',\n {\n name: name ? name : 'TEST',\n branch: process.env.GIT_BRANCH ? process.env.GIT_BRANCH : 'main',\n video_id: process.env.VIDEO_ID,\n browser: process.env.BROWSER ? process.env.BROWSER : 'chromium',\n mode:\n process.env.MODE === 'cloud'\n ? 'cloud'\n : process.env.MODE === 'executions'\n ? 'executions'\n : 'local',\n env: { name: env?.name, baseUrl: env?.baseUrl },\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n if (runDocResult.status !== 200) {\n throw new Error('Failed to create run document in the server')\n }\n if (runDocResult.data.status !== true) {\n throw new Error('Failed to create run document in the server')\n }\n return runDocResult.data.run\n } catch (error) {\n if (error.response && error.response.status === 403) {\n console.log(\n 'Warning: Your trial plan has ended. Cannot create or upload reports.'\n )\n process.exit(1)\n }\n throw new Error('Failed to create run document in the server: ' + error)\n }\n }\n async updateProjectAnalytics(projectId: string) {\n if (process.env.UPLOADREPORTS === 'false') {\n return\n }\n try {\n await axiosClient.post(\n this.runsApiBaseURL + '/project/updateAIRecoveryCount',\n {\n projectId,\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n } catch (error) {\n console.error('Failed to update project metadata:', error)\n }\n }\n async upload(formData: FormData) {\n if (process.env.UPLOADREPORTS === 'false') {\n return\n }\n const response = await axiosClient.post(\n this.runsApiBaseURL + '/cucumber-runs/upload',\n formData,\n {\n headers: {\n ...formData.getHeaders(),\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n if (response.status === 401) {\n console.log(\n 'Warning: Your trial plan has ended. Cannot upload reports and perform retraining'\n )\n throw new Error(\n 'Warning: Your trial plan has ended. Cannot upload reports and perform retraining'\n )\n }\n if (response.status !== 200) {\n throw new Error('Failed to upload run to the server')\n }\n if (response.data.status !== true) {\n throw new Error('Failed to upload run to the server')\n }\n }\n async getPreSignedUrls(fileUris: string[], runId: string) {\n if (process.env.UPLOADREPORTS === 'false') {\n return {}\n }\n const response = await axiosClient.post(\n this.runsApiBaseURL + '/cucumber-runs/generateuploadurls',\n {\n fileUris,\n runId,\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n if (response.status === 403) {\n console.log(\n 'Warning: Your trial plan has ended. Cannot upload reports and perform retraining'\n )\n throw new Error(\n 'Warning: Your trial plan has ended. Cannot upload reports and perform retraining'\n )\n }\n if (response.status !== 200) {\n throw new Error('Failed to get pre-signed urls for the files')\n }\n if (response.data.status !== true) {\n throw new Error('Failed to get pre-signed urls for the files')\n }\n\n return response.data.uploadUrls\n }\n\n async uploadTestCase(\n testCaseReport: JsonTestProgress,\n runId: string,\n projectId: string,\n reportFolder: string,\n rerunId?: string\n ) {\n if (process.env.UPLOADREPORTS === 'false') {\n return null\n }\n const fileUris = []\n //iterate over all the files in the JsonCommand.screenshotId and insert them into the fileUris array\n for (const step of testCaseReport.steps) {\n for (const command of step.commands) {\n if (command.screenshotId) {\n fileUris.push(\n 'screenshots' + '/' + String(command.screenshotId) + '.png'\n )\n }\n }\n if (step.traceFilePath) {\n fileUris.push('trace' + '/' + step.traceFilePath)\n }\n }\n if (testCaseReport.logFileId) {\n fileUris.push(\n 'editorLogs' + '/' + 'testCaseLog_' + testCaseReport.logFileId + '.log'\n )\n }\n // console.log({ fileUris })\n const preSignedUrls = await this.getPreSignedUrls(fileUris, runId)\n //upload all the files in the fileUris array\n try {\n for (let i = 0; i < fileUris.length; i += BATCH_SIZE) {\n const batch = fileUris.slice(\n i,\n Math.min(i + BATCH_SIZE, fileUris.length)\n )\n await Promise.all(\n batch\n .filter((fileUri) => preSignedUrls[fileUri])\n .map(async (fileUri) => {\n for (let j = 0; j < MAX_RETRIES; j++) {\n if (existsSync(path.join(reportFolder, fileUri))) {\n const success = await this.uploadFile(\n path.join(reportFolder, fileUri),\n preSignedUrls[fileUri]\n )\n if (success) {\n return\n }\n }\n const success = await this.uploadFile(\n path.join(reportFolder, fileUri),\n preSignedUrls[fileUri]\n )\n if (success) {\n return\n }\n }\n console.error('Failed to upload file:', fileUri)\n })\n )\n }\n\n // writeFileSync(\"report.json\", JSON.stringify(testCaseReport, null, 2))\n const mode =\n process.env.MODE === 'cloud'\n ? 'cloud'\n : process.env.MODE === 'executions'\n ? 'executions'\n : 'local'\n\n let rerunIdFinal = null\n\n rerunIdFinal = process.env.RETRY_ID || null\n if (rerunId) {\n rerunIdFinal = rerunId.includes(runId) ? rerunId : `${runId}${rerunId}`\n }\n\n if (mode === 'executions') {\n testCaseReport.id = process.env.VIDEO_ID || testCaseReport.id\n }\n\n const { data } = await axiosClient.post<FinishTestCaseResponse>(\n this.runsApiBaseURL + '/cucumber-runs/createNewTestCase',\n {\n runId,\n projectId,\n testProgressReport: testCaseReport,\n browser: process.env.BROWSER ? process.env.BROWSER : 'chromium',\n mode,\n rerunId: rerunIdFinal,\n video_id: process.env.VIDEO_ID,\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n\n try {\n await axiosClient.post(\n `${SERVICES_URI.STORAGE}/event`,\n {\n event: ActionEvents.upload_report,\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n 'x-bvt-project-id': projectId,\n },\n }\n )\n } catch (error) {\n // no event tracking\n }\n logReportLink(runId, projectId, testCaseReport.result)\n return data\n } catch (e) {\n console.error(`failed to upload the test case: ${testCaseReport.id} ${e}`)\n return null\n }\n }\n async uploadFile(filePath: string, preSignedUrl: string) {\n if (process.env.UPLOADREPORTS === 'false') {\n return true\n }\n const fileStream = createReadStream(filePath)\n let success = true\n try {\n const fileStats = await fs.stat(filePath)\n const fileSize = fileStats.size\n\n await axiosClient.put(preSignedUrl, fileStream, {\n headers: {\n 'Content-Type': 'application/octet-stream',\n 'Content-Length': fileSize,\n },\n })\n } catch (error) {\n if (process.env.NODE_ENV_BLINQ === 'dev') {\n console.error('Error uploading file:', error)\n }\n success = false\n } finally {\n fileStream.close()\n }\n return success\n }\n async uploadComplete(runId: string, projectId: string) {\n if (process.env.UPLOADREPORTS === 'false') {\n return\n }\n const response = await axiosClient.post(\n this.runsApiBaseURL + '/cucumber-runs/uploadCompletion',\n {\n runId,\n projectId,\n browser: process.env.BROWSER ? process.env.BROWSER : 'chromium',\n mode:\n process.env.MODE === 'cloud'\n ? 'cloud'\n : process.env.MODE === 'executions'\n ? 'executions'\n : 'local',\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n if (response.status !== 200) {\n throw new Error('Failed to mark run as complete')\n }\n if (response.data.status !== true) {\n throw new Error('Failed to mark run as complete')\n }\n\n try {\n await axiosClient.post(\n `${SERVICES_URI.STORAGE}/event`,\n {\n event: ActionEvents.upload_report,\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n 'x-bvt-project-id': projectId,\n },\n }\n )\n } catch (error) {\n // no event tracking\n }\n }\n async modifyTestCase(\n runId: string,\n projectId: string,\n testProgressReport: JsonTestProgress\n ) {\n if (process.env.UPLOADREPORTS === 'false') {\n return\n }\n try {\n const res = await axiosClient.post(\n this.runsApiBaseURL + '/cucumber-runs/modifyTestCase',\n {\n runId,\n projectId,\n testProgressReport,\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n if (res.status !== 200) {\n throw new Error('')\n }\n if (res.data.status !== true) {\n throw new Error('')\n }\n logReportLink(runId, projectId, testProgressReport.result)\n } catch (e) {\n console.error(\n `failed to modify the test case: ${testProgressReport.id} ${e}`\n )\n }\n }\n async createStatus(status: string) {\n if (process.env.UPLOADREPORTS === 'false') {\n return\n }\n if (!process.env.UUID) {\n return\n }\n\n try {\n await axiosClient.post(\n this.runsApiBaseURL + '/scenarios/status',\n {\n status: { status },\n uuid: process.env.UUID,\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n } catch (error) {\n console.log('Failed to send status to the server, ignoring it')\n }\n }\n}\n\nexport { RunUploadService }\n"]}
1
+ {"version":3,"file":"upload_serivce.js","sourceRoot":"","sources":["../../../src/formatter/helpers/upload_serivce.ts"],"names":[],"mappings":";;;;;;;AAEA,2BAAuE;AACvE,2DAA4B;AAC5B,sDAA4B;AAG5B,mEAA8D;AAC9D,gDAAuB;AACvB,sEAIkC;AAClC,2CAAwD;AAExD,MAAM,kBAAkB,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,kBAAkB,mCAAI,GAAG,CAAA;AAChE,MAAM,UAAU,GAAG,EAAE,CAAA;AACrB,MAAM,WAAW,GAAG,CAAC,CAAA;AACrB,MAAM,oBAAoB,GACxB,MAAA,OAAO,CAAC,GAAG,CAAC,KAAK,mCAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAA;AAevD,MAAM,gBAAgB;IACpB,YACU,cAAsB,EACtB,WAAmB;QADnB,mBAAc,GAAd,cAAc,CAAQ;QACtB,gBAAW,GAAX,WAAW,CAAQ;IAC1B,CAAC;IACJ,KAAK,CAAC,iBAAiB,CAAC,IAAY,EAAE,GAAQ;QAC5C,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,OAAO,EAAE;YACzC,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAA;YACtE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;SACvD;QACD,IAAI;YACF,MAAM,YAAY,GAAG,MAAM,0BAAW,CAAC,IAAI,CACzC,IAAI,CAAC,cAAc,GAAG,uBAA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AC,GAAG,CAAC,IAAI;aACvB,EACD;gBACE,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,GAAG,IAAI,CAAC,WAAW;oBAC3C,UAAU,EAAE,aAAa;iBAC1B;aACF,CACF,CAAA;SACF;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAA;SAChE;IACH,CAAC;CACF;AAEQ,4CAAgB","sourcesContent":["/* eslint-disable no-console */\nimport FormData from 'form-data'\nimport { createReadStream, existsSync, write, writeFileSync } from 'fs'\nimport fs from 'fs/promises'\nimport pLimit from 'p-limit'\n\nimport { JsonReport, JsonTestProgress } from './report_generator'\nimport { axiosClient } from '../../configuration/axios_client'\nimport path from 'path'\nimport {\n createNewTestCase,\n logReportLink,\n postUploadReportEvent,\n} from '../bvt_analysis_formatter'\nimport { ActionEvents, SERVICES_URI } from './constants'\n\nconst REPORT_SERVICE_URL = process.env.REPORT_SERVICE_URL ?? URL\nconst BATCH_SIZE = 10\nconst MAX_RETRIES = 3\nconst REPORT_SERVICE_TOKEN =\n process.env.TOKEN ?? process.env.REPORT_SERVICE_TOKEN\n\nexport interface RootCauseProps {\n status: boolean\n analysis: string\n failedStep: number\n failClass: string\n}\n\nexport interface FinishTestCaseResponse {\n status: true\n rootCause: RootCauseProps\n report: JsonTestProgress\n}\n\nclass RunUploadService {\n constructor(\n private runsApiBaseURL: string,\n private accessToken: string\n ) {}\n async createRunDocument(name: string, env: any) {\n if (process.env.UPLOADREPORTS === 'false') {\n console.log('Skipping report upload as UPLOADREPORTS is set to false')\n return { id: 'local-run', projectId: 'local-project' }\n }\n try {\n const runDocResult = await axiosClient.post(\n this.runsApiBaseURL + '/cucumber-runs/create',\n {\n name: name ? name : 'TEST',\n branch: process.env.GIT_BRANCH ? process.env.GIT_BRANCH : 'main',\n video_id: process.env.VIDEO_ID,\n browser: process.env.BROWSER ? process.env.BROWSER : 'chromium',\n mode:\n process.env.MODE === 'cloud'\n ? 'cloud'\n : process.env.MODE === 'executions'\n ? 'executions'\n : 'local',\n env: { name: env?.name, baseUrl: env?.baseUrl },\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n if (runDocResult.status !== 200) {\n throw new Error('Failed to create run document in the server')\n }\n if (runDocResult.data.status !== true) {\n throw new Error('Failed to create run document in the server')\n }\n return runDocResult.data.run\n } catch (error) {\n if (error.response && error.response.status === 403) {\n console.log(\n 'Warning: Your trial plan has ended. Cannot create or upload reports.'\n )\n process.exit(1)\n }\n throw new Error('Failed to create run document in the server: ' + error)\n }\n }\n async updateProjectAnalytics(projectId: string) {\n if (process.env.UPLOADREPORTS === 'false') {\n return\n }\n try {\n await axiosClient.post(\n this.runsApiBaseURL + '/project/updateAIRecoveryCount',\n {\n projectId,\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n } catch (error) {\n console.error('Failed to update project metadata:', error)\n }\n }\n async upload(formData: FormData) {\n if (process.env.UPLOADREPORTS === 'false') {\n return\n }\n const response = await axiosClient.post(\n this.runsApiBaseURL + '/cucumber-runs/upload',\n formData,\n {\n headers: {\n ...formData.getHeaders(),\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n if (response.status === 401) {\n console.log(\n 'Warning: Your trial plan has ended. Cannot upload reports and perform retraining'\n )\n throw new Error(\n 'Warning: Your trial plan has ended. Cannot upload reports and perform retraining'\n )\n }\n if (response.status !== 200) {\n throw new Error('Failed to upload run to the server')\n }\n if (response.data.status !== true) {\n throw new Error('Failed to upload run to the server')\n }\n }\n async getPreSignedUrls(fileUris: string[], runId: string) {\n if (process.env.UPLOADREPORTS === 'false') {\n return {}\n }\n const response = await axiosClient.post(\n this.runsApiBaseURL + '/cucumber-runs/generateuploadurls',\n {\n fileUris,\n runId,\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n if (response.status === 403) {\n console.log(\n 'Warning: Your trial plan has ended. Cannot upload reports and perform retraining'\n )\n throw new Error(\n 'Warning: Your trial plan has ended. Cannot upload reports and perform retraining'\n )\n }\n if (response.status !== 200) {\n throw new Error('Failed to get pre-signed urls for the files')\n }\n if (response.data.status !== true) {\n throw new Error('Failed to get pre-signed urls for the files')\n }\n\n return response.data.uploadUrls\n }\n\n async uploadTestCase(\n testCaseReport: JsonTestProgress,\n runId: string,\n projectId: string,\n reportFolder: string,\n rerunId?: string\n ) {\n if (process.env.UPLOADREPORTS === 'false') return null\n\n const fileUris: string[] = []\n\n // Collect screenshot + trace + logs\n for (const step of testCaseReport.steps) {\n for (const command of step.commands) {\n if (command.screenshotId)\n fileUris.push(`screenshots/${command.screenshotId}.png`)\n }\n if (step.traceFilePath) fileUris.push(`trace/${step.traceFilePath}`)\n }\n if (testCaseReport.logFileId)\n fileUris.push(`editorLogs/testCaseLog_${testCaseReport.logFileId}.log`)\n if (testCaseReport.traceFileId)\n fileUris.push(`trace/${testCaseReport.traceFileId}`)\n\n // 🔹 UPLOAD FILES\n try {\n const preSignedUrls = await this.getPreSignedUrls(fileUris, runId)\n await this.uploadFilesInBatches(fileUris, reportFolder, preSignedUrls)\n } catch (error: any) {\n console.error('🟥 Error uploading files:', {\n message: error?.message,\n stack: error?.stack,\n })\n }\n\n // 🔹 UPLOAD FINAL TEST REPORT\n try {\n const mode =\n process.env.MODE === 'cloud'\n ? 'cloud'\n : process.env.MODE === 'executions'\n ? 'executions'\n : 'local'\n let rerunIdFinal = process.env.RETRY_ID || null\n if (rerunId)\n rerunIdFinal = rerunId.includes(runId) ? rerunId : `${runId}${rerunId}`\n if (mode === 'executions')\n testCaseReport.id = process.env.VIDEO_ID || testCaseReport.id\n\n const payload = {\n runId,\n projectId,\n testProgressReport: testCaseReport,\n browser: process.env.BROWSER || 'chromium',\n mode,\n rerunId: rerunIdFinal,\n video_id: process.env.VIDEO_ID,\n }\n\n const data = await createNewTestCase(\n payload,\n this.runsApiBaseURL,\n this.accessToken\n )\n await postUploadReportEvent(projectId, this.accessToken)\n logReportLink(runId, projectId, testCaseReport.result)\n return data\n } catch (e: any) {\n console.error('🟥 Failed to upload test case:', {\n testCaseId: testCaseReport.id,\n message: e?.message,\n status: e?.response?.status,\n responseSnippet: e?.response?.data?.toString()?.slice(0, 300),\n stack: e?.stack,\n })\n return null\n }\n }\n\n /**\n * Improving error logging\n * 🔧 Sanitizes Axios errors to avoid dumping Cloudflare HTML (524, 502, etc.)\n */\n private sanitizeError(error: any) {\n // Handle Axios-style errors with response\n if (error?.response) {\n const { data, status } = error.response\n\n // If Cloudflare or HTML error page → return a short meaningful message\n if (typeof data === 'string' && data.includes('<!DOCTYPE html')) {\n return `[HTML_ERROR_PAGE] status=${status} - likely Cloudflare timeout or proxy error`\n }\n\n // If data is a JSON object, stringify it with indentation for readability\n if (typeof data === 'object') {\n return JSON.stringify(data, null, 2) // Pretty-print the JSON response\n }\n\n // If response is a string (could be an error message), return it trimmed\n return data?.trim() || `Unknown response data (status: ${status})`\n }\n\n // System / network errors (e.g., if Axios cannot reach the server)\n if (error?.message) {\n return error.message\n }\n\n // If the error has a stack (for debugging purposes)\n if (error?.stack) {\n return `${error.message}\\n${error.stack}`\n }\n\n // If it's a generic error object, attempt to stringify it in a readable format\n return JSON.stringify(\n error,\n (key, value) => {\n // Avoid circular references or sensitive data\n if (key === 'password' || key === 'accessToken') return '[REDACTED]'\n return value\n },\n 2\n ) // Pretty-print the error object with indentation\n }\n async uploadFileWithRetries(filePath: string, presignedUrl: string) {\n const MAX_RETRIES = 3\n const RETRY_DELAY_MS = 1000\n for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {\n try {\n const ok = await this.uploadFile(filePath, presignedUrl)\n if (ok) return true\n } catch (err: any) {\n console.error(`Upload attempt #${attempt} failed for ${filePath}:`, {\n message: err?.message,\n stack: err?.stack,\n })\n if (attempt < MAX_RETRIES) {\n await new Promise((r) => setTimeout(r, RETRY_DELAY_MS * attempt))\n }\n }\n }\n console.error(\n `Failed to upload file after ${MAX_RETRIES} retries: ${filePath}`\n )\n return false\n }\n\n async uploadFilesInBatches(\n fileUris: string[],\n reportFolder: string,\n preSignedUrls: Record<string, string>\n ) {\n const MAX_CONCURRENCY = 5\n const limit = pLimit(MAX_CONCURRENCY)\n const tasks = fileUris\n .filter((uri) => preSignedUrls[uri])\n .map((uri) =>\n limit(async () => {\n const filePath = path.join(reportFolder, uri)\n if (existsSync(filePath)) {\n await this.uploadFileWithRetries(filePath, preSignedUrls[uri])\n }\n })\n )\n\n await Promise.all(tasks)\n }\n\n async uploadFile(filePath: string, preSignedUrl: string) {\n if (process.env.UPLOADREPORTS === 'false') {\n return true\n }\n const fileStream = createReadStream(filePath)\n let success = true\n try {\n const fileStats = await fs.stat(filePath)\n const fileSize = fileStats.size\n\n await axiosClient.put(preSignedUrl, fileStream, {\n headers: {\n 'Content-Type': 'application/octet-stream',\n 'Content-Length': fileSize,\n },\n })\n } catch (error) {\n if (process.env.MODE === 'executions') {\n const sanitized = this.sanitizeError(error)\n console.error(\n '❌ Error uploading file at:',\n filePath,\n 'due to',\n sanitized\n )\n }\n success = false\n } finally {\n fileStream.close()\n }\n return success\n }\n async uploadComplete(runId: string, projectId: string) {\n if (process.env.UPLOADREPORTS === 'false') {\n return\n }\n const response = await axiosClient.post(\n this.runsApiBaseURL + '/cucumber-runs/uploadCompletion',\n {\n runId,\n projectId,\n browser: process.env.BROWSER ? process.env.BROWSER : 'chromium',\n mode:\n process.env.MODE === 'cloud'\n ? 'cloud'\n : process.env.MODE === 'executions'\n ? 'executions'\n : 'local',\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n if (response.status !== 200) {\n throw new Error('Failed to mark run as complete')\n }\n if (response.data.status !== true) {\n throw new Error('Failed to mark run as complete')\n }\n\n try {\n await axiosClient.post(\n `${SERVICES_URI.STORAGE}/event`,\n {\n event: ActionEvents.upload_report,\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n 'x-bvt-project-id': projectId,\n },\n }\n )\n } catch (error) {\n // no event tracking\n }\n }\n async modifyTestCase(\n runId: string,\n projectId: string,\n testProgressReport: JsonTestProgress\n ) {\n if (process.env.UPLOADREPORTS === 'false') {\n return\n }\n try {\n const res = await axiosClient.post(\n this.runsApiBaseURL + '/cucumber-runs/modifyTestCase',\n {\n runId,\n projectId,\n testProgressReport,\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n if (res.status !== 200) {\n throw new Error('')\n }\n if (res.data.status !== true) {\n throw new Error('')\n }\n logReportLink(runId, projectId, testProgressReport.result)\n } catch (e) {\n console.error(\n `failed to modify the test case: ${testProgressReport.id} ${e}`\n )\n }\n }\n async createStatus(status: string) {\n if (process.env.UPLOADREPORTS === 'false') {\n return\n }\n if (!process.env.UUID) {\n return\n }\n\n try {\n await axiosClient.post(\n this.runsApiBaseURL + '/scenarios/status',\n {\n status: { status },\n uuid: process.env.UUID,\n },\n {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n 'x-source': 'cucumber_js',\n },\n }\n )\n } catch (error) {\n console.log('Failed to send status to the server, ignoring it')\n }\n }\n}\n\nexport { RunUploadService }\n"]}
@@ -1,9 +1,10 @@
1
1
  import SummaryFormatter from './summary_formatter';
2
2
  import { IFormatterOptions } from './index';
3
3
  import * as messages from '@cucumber/messages';
4
- import ITestStepFinished = messages.TestStepFinished;
4
+ type ITestStepFinished = messages.TestStepFinished;
5
5
  export default class ProgressFormatter extends SummaryFormatter {
6
6
  static readonly documentation: string;
7
7
  constructor(options: IFormatterOptions);
8
8
  logProgress({ testStepResult: { status } }: ITestStepFinished): void;
9
9
  }
10
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"progress_formatter.js","sourceRoot":"","sources":["../../src/formatter/progress_formatter.ts"],"names":[],"mappings":";;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CAAA;IACrB,CAAC;;AApBH,oCAqBC;AApBwB,+BAAa,GAClC,oCAAoC,CAAA","sourcesContent":["import SummaryFormatter from './summary_formatter'\nimport { doesHaveValue } from '../value_checker'\nimport { IFormatterOptions } from './index'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\nimport ITestStepFinished = messages.TestStepFinished\n\nconst STATUS_CHARACTER_MAPPING: Map<messages.TestStepResultStatus, string> =\n new Map([\n [messages.TestStepResultStatus.AMBIGUOUS, 'A'],\n [messages.TestStepResultStatus.FAILED, 'F'],\n [messages.TestStepResultStatus.PASSED, '.'],\n [messages.TestStepResultStatus.PENDING, 'P'],\n [messages.TestStepResultStatus.SKIPPED, '-'],\n [messages.TestStepResultStatus.UNDEFINED, 'U'],\n ])\n\nexport default class ProgressFormatter extends SummaryFormatter {\n public static readonly documentation: string =\n 'Prints one character per scenario.'\n\n constructor(options: IFormatterOptions) {\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.log('\\n\\n')\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.logProgress(envelope.testStepFinished)\n }\n })\n super(options)\n }\n\n logProgress({ testStepResult: { status } }: ITestStepFinished): void {\n const character = this.colorFns.forStatus(status)(\n STATUS_CHARACTER_MAPPING.get(status)\n )\n this.log(character)\n }\n}\n"]}
1
+ {"version":3,"file":"progress_formatter.js","sourceRoot":"","sources":["../../src/formatter/progress_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4EAAkD;AAClD,oDAAgD;AAEhD,6DAA8C;AAI9C,MAAM,wBAAwB,GAC5B,IAAI,GAAG,CAAC;IACN,CAAC,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAAE,GAAG,CAAC;IAC9C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC;IAC5C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC;IAC5C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAAE,GAAG,CAAC;CAC/C,CAAC,CAAA;AAEJ,MAAqB,iBAAkB,SAAQ,2BAAgB;IAI7D,YAAY,OAA0B;QACpC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;aACjB;iBAAM,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;gBACnD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAA;aAC5C;QACH,CAAC,CAAC,CAAA;QACF,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;IAED,WAAW,CAAC,EAAE,cAAc,EAAE,EAAE,MAAM,EAAE,EAAqB;QAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAC/C,wBAAwB,CAAC,GAAG,CAAC,MAAM,CAAC,CACrC,CAAA;QACD,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACrB,CAAC;;AApBH,oCAqBC;AApBwB,+BAAa,GAClC,oCAAoC,CAAA","sourcesContent":["import SummaryFormatter from './summary_formatter'\nimport { doesHaveValue } from '../value_checker'\nimport { IFormatterOptions } from './index'\nimport * as messages from '@cucumber/messages'\ntype IEnvelope = messages.Envelope\ntype ITestStepFinished = messages.TestStepFinished\n\nconst STATUS_CHARACTER_MAPPING: Map<messages.TestStepResultStatus, string> =\n new Map([\n [messages.TestStepResultStatus.AMBIGUOUS, 'A'],\n [messages.TestStepResultStatus.FAILED, 'F'],\n [messages.TestStepResultStatus.PASSED, '.'],\n [messages.TestStepResultStatus.PENDING, 'P'],\n [messages.TestStepResultStatus.SKIPPED, '-'],\n [messages.TestStepResultStatus.UNDEFINED, 'U'],\n ])\n\nexport default class ProgressFormatter extends SummaryFormatter {\n public static readonly documentation: string =\n 'Prints one character per scenario.'\n\n constructor(options: IFormatterOptions) {\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.log('\\n\\n')\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.logProgress(envelope.testStepFinished)\n }\n })\n super(options)\n }\n\n logProgress({ testStepResult: { status } }: ITestStepFinished): void {\n const character = this.colorFns.forStatus(status)(\n STATUS_CHARACTER_MAPPING.get(status)\n )\n this.log(character)\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"snippets_formatter.js","sourceRoot":"","sources":["../../src/formatter/snippets_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAiD;AACjD,uCAAgD;AAChD,oDAAgD;AAChD,6DAA8C;AAG9C,MAAqB,iBAAkB,SAAQ,UAAS;IAItD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,WAAW,EAAE,CAAA;aACnB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,WAAW;QACT,MAAM,QAAQ,GAAa,EAAE,CAAA;QAC7B,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,EAAE;YACxE,MAAM,MAAM,GAAG,IAAA,8BAAoB,EAAC;gBAClC,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,eAAe;aAChB,CAAC,CAAA;YACF,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACpC,IACE,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAClE;oBACA,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;iBAChC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,CAAC;;AA9BH,oCA+BC;AA9BwB,+BAAa,GAClC,iIAAiI,CAAA","sourcesContent":["import Formatter, { IFormatterOptions } from './'\nimport { parseTestCaseAttempt } from './helpers'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\n\nexport default class SnippetsFormatter extends Formatter {\n public static readonly documentation: string =\n \"The Snippets Formatter doesn't output anything regarding the test run; it just prints snippets to implement any undefined steps\"\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logSnippets()\n }\n })\n }\n\n logSnippets(): void {\n const snippets: string[] = []\n this.eventDataCollector.getTestCaseAttempts().forEach((testCaseAttempt) => {\n const parsed = parseTestCaseAttempt({\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n })\n parsed.testSteps.forEach((testStep) => {\n if (\n testStep.result.status === messages.TestStepResultStatus.UNDEFINED\n ) {\n snippets.push(testStep.snippet)\n }\n })\n })\n this.log(snippets.join('\\n\\n'))\n }\n}\n"]}
1
+ {"version":3,"file":"snippets_formatter.js","sourceRoot":"","sources":["../../src/formatter/snippets_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAiD;AACjD,uCAAgD;AAChD,oDAAgD;AAChD,6DAA8C;AAG9C,MAAqB,iBAAkB,SAAQ,UAAS;IAItD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,WAAW,EAAE,CAAA;aACnB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,WAAW;QACT,MAAM,QAAQ,GAAa,EAAE,CAAA;QAC7B,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,EAAE;YACxE,MAAM,MAAM,GAAG,IAAA,8BAAoB,EAAC;gBAClC,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,eAAe;aAChB,CAAC,CAAA;YACF,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACpC,IACE,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAClE;oBACA,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;iBAChC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,CAAC;;AA9BH,oCA+BC;AA9BwB,+BAAa,GAClC,iIAAiI,CAAA","sourcesContent":["import Formatter, { IFormatterOptions } from './'\nimport { parseTestCaseAttempt } from './helpers'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\ntype IEnvelope = messages.Envelope\n\nexport default class SnippetsFormatter extends Formatter {\n public static readonly documentation: string =\n \"The Snippets Formatter doesn't output anything regarding the test run; it just prints snippets to implement any undefined steps\"\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logSnippets()\n }\n })\n }\n\n logSnippets(): void {\n const snippets: string[] = []\n this.eventDataCollector.getTestCaseAttempts().forEach((testCaseAttempt) => {\n const parsed = parseTestCaseAttempt({\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n })\n parsed.testSteps.forEach((testStep) => {\n if (\n testStep.result.status === messages.TestStepResultStatus.UNDEFINED\n ) {\n snippets.push(testStep.snippet)\n }\n })\n })\n this.log(snippets.join('\\n\\n'))\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"usage_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoD;AACpD,0CAAiD;AACjD,4DAA8B;AAC9B,oDAAgD;AAChD,6DAA8C;AAG9C,MAAqB,cAAe,SAAQ,UAAS;IAInD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC;YACrB,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe;YACxD,kBAAkB,EAAE,IAAI,CAAC,k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AC,KAAK,EAAE,EAAE;gBACpC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;gBAC5B,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;oBACjC,IAAI,CAAC,IAAI,CACP,GAAG,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAC/C,KAAK,CAAC,QAAQ,CACf,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CACjB,CAAA;iBACF;qBAAM;oBACL,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;iBACf;gBACD,IAAI,CAAC,IAAI,CAAC,IAAA,wBAAc,EAAC,KAAK,CAAC,CAAC,CAAA;YAClC,CAAC,CAAC,CAAA;YACF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;gBACtB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;aACvD;YACD,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAQ,CAAC,CAAA;QACxE,CAAC,CACF,CAAA;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC;;AAvEH,iCAwEC;AAvEwB,4BAAa,GAClC,6MAA6M,CAAA","sourcesContent":["import { formatLocation, getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport Table from 'cli-table3'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\n\nexport default class UsageFormatter extends Formatter {\n public static readonly documentation: string =\n 'Prints where step definitions are used. The slowest step definitions (with duration) are listed first. If --dry-run is used the duration is not shown, and step definitions are sorted by filename instead.'\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n if (usage.length === 0) {\n this.log('No step definitions')\n return\n }\n const table = new Table({\n head: ['Pattern / Text', 'Duration', 'Location'],\n style: {\n border: [],\n head: [],\n },\n })\n usage.forEach(\n ({ line, matches, meanDuration, pattern, patternType, uri }) => {\n let formattedPattern = pattern\n if (patternType === 'RegularExpression') {\n formattedPattern = '/' + formattedPattern + '/'\n }\n const col1 = [formattedPattern]\n const col2 = []\n if (matches.length > 0) {\n if (doesHaveValue(meanDuration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n meanDuration\n ).toFixed(2)}ms`\n )\n } else {\n col2.push('-')\n }\n } else {\n col2.push('UNUSED')\n }\n const col3 = [formatLocation({ line, uri })]\n matches.slice(0, 5).forEach((match) => {\n col1.push(` ${match.text}`)\n if (doesHaveValue(match.duration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n match.duration\n ).toFixed(2)}ms`\n )\n } else {\n col2.push('-')\n }\n col3.push(formatLocation(match))\n })\n if (matches.length > 5) {\n col1.push(` ${(matches.length - 5).toString()} more`)\n }\n table.push([col1.join('\\n'), col2.join('\\n'), col3.join('\\n')] as any)\n }\n )\n this.log(`${table.toString()}\\n`)\n }\n}\n"]}
1
+ {"version":3,"file":"usage_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoD;AACpD,0CAAiD;AACjD,4DAA8B;AAC9B,oDAAgD;AAChD,6DAA8C;AAG9C,MAAqB,cAAe,SAAQ,UAAS;IAInD,YAAY,OAA0B;QACpC,KAAK,CA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IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC;;AAvEH,iCAwEC;AAvEwB,4BAAa,GAClC,6MAA6M,CAAA","sourcesContent":["import { formatLocation, getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport Table from 'cli-table3'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\ntype IEnvelope = messages.Envelope\n\nexport default class UsageFormatter extends Formatter {\n public static readonly documentation: string =\n 'Prints where step definitions are used. The slowest step definitions (with duration) are listed first. If --dry-run is used the duration is not shown, and step definitions are sorted by filename instead.'\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n if (usage.length === 0) {\n this.log('No step definitions')\n return\n }\n const table = new Table({\n head: ['Pattern / Text', 'Duration', 'Location'],\n style: {\n border: [],\n head: [],\n },\n })\n usage.forEach(\n ({ line, matches, meanDuration, pattern, patternType, uri }) => {\n let formattedPattern = pattern\n if (patternType === 'RegularExpression') {\n formattedPattern = '/' + formattedPattern + '/'\n }\n const col1 = [formattedPattern]\n const col2 = []\n if (matches.length > 0) {\n if (doesHaveValue(meanDuration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n meanDuration\n ).toFixed(2)}ms`\n )\n } else {\n col2.push('-')\n }\n } else {\n col2.push('UNUSED')\n }\n const col3 = [formatLocation({ line, uri })]\n matches.slice(0, 5).forEach((match) => {\n col1.push(` ${match.text}`)\n if (doesHaveValue(match.duration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n match.duration\n ).toFixed(2)}ms`\n )\n } else {\n col2.push('-')\n }\n col3.push(formatLocation(match))\n })\n if (matches.length > 5) {\n col1.push(` ${(matches.length - 5).toString()} more`)\n }\n table.push([col1.join('\\n'), col2.join('\\n'), col3.join('\\n')] as any)\n }\n )\n this.log(`${table.toString()}\\n`)\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"usage_json_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_json_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAAoC;AACpC,0CAAiD;AACjD,oDAAgD;AAIhD,MAAqB,kBAAmB,SAAQ,UAAS;IAIvD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC;YACrB,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe;YACxD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IACnD,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAU;QAC9B,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAA;SACvB;QACD,OAAO,KAAK,CAAA;IACd,CAAC;;AA1BH,qCA2BC;AA1BwB,gCAAa,GAClC,uHAAuH,CAAA","sourcesContent":["import { getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\n\nexport default class UsageJsonFormatter extends Formatter {\n public static readonly documentation: string =\n 'Does what the Usage Formatter does, but outputs JSON, which can be output to a file and then consumed by other tools.'\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n this.log(JSON.stringify(usage, this.replacer, 2))\n }\n\n replacer(key: string, value: any): any {\n if (key === 'seconds') {\n return parseInt(value)\n }\n return value\n }\n}\n"]}
1
+ {"version":3,"file":"usage_json_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_json_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAAoC;AACpC,0CAAiD;AACjD,oDAAgD;AAIhD,MAAqB,kBAAmB,SAAQ,UAAS;IAIvD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC;YACrB,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe;YACxD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IACnD,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAU;QAC9B,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAA;SACvB;QACD,OAAO,KAAK,CAAA;IACd,CAAC;;AA1BH,qCA2BC;AA1BwB,gCAAa,GAClC,uHAAuH,CAAA","sourcesContent":["import { getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\ntype IEnvelope = messages.Envelope\n\nexport default class UsageJsonFormatter extends Formatter {\n public static readonly documentation: string =\n 'Does what the Usage Formatter does, but outputs JSON, which can be output to a file and then consumed by other tools.'\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n this.log(JSON.stringify(usage, this.replacer, 2))\n }\n\n replacer(key: string, value: any): any {\n if (key === 'seconds') {\n return parseInt(value)\n }\n return value\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/models/definition.ts"],"names":[],"mappings":";;AAwDA,MAA8B,UAAU;IAQtC,YAAY,EACV,IAAI,EACJ,EAAE,EACF,IAAI,EACJ,OAAO,EACP,aAAa,EACb,GAAG,GACuC;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,6BAA6B,CAC3B,mBAAoC,EACpC,cAA+B;QAE/B,OAAO,CACL,gBAAgB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY;YACvD,iBAAiB,mBAAmB,CAAC,QAAQ,EAAE,0CAA0C;YACzF,OAAO,cAAc,CAAC,QAAQ,EAAE,4BAA4B,CAC7D,CAAA;IACH,CAAC;IAED,+BAA+B,CAAC,UAAiB;QAC/C,OAAO,IAAI,CAAC,6BAA6B,CACvC,UAAU,CAAC,MAAM,EACjB,UAAU,CAAC,MAAM,GAAG,CAAC,CACtB,CAAA;IACH,CAAC;CACF;AAzCD,6BAyCC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { ITestCaseHookParameter } from '../support_code_library_builder/types'\nimport { Expression } from '@cucumber/cucumber-expressions'\nimport { GherkinStepKeyword } from './gherkin_step_keyword'\n\nexport interface IGetInvocationDataRequest {\n hookParameter: ITestCaseHookParameter\n step: messages.PickleStep\n world: any\n}\n\nexport interface IGetInvocationDataResponse {\n getInvalidCodeLengthMessage: () => string\n parameters: any[]\n validCodeLengths: number[]\n}\n\nexport interface IDefinitionOptions {\n timeout?: number\n wrapperOptions?: any\n}\n\nexport interface IHookDefinitionOptions extends IDefinitionOptions {\n name?: string\n tags?: string\n}\n\nexport interface IDefinitionParameters<T extends IDefinitionOptions> {\n code: Function\n id: string\n line: number\n options: T\n unwrappedCode?: Function\n uri: string\n}\n\nexport interface IStepDefinitionParameters\n extends IDefinitionParameters<IDefinitionOptions> {\n keyword: GherkinStepKeyword\n pattern: string | RegExp\n expression: Expression\n}\n\nexport interface IDefinition {\n readonly code: Function\n readonly id: string\n readonly line: number\n readonly options: IDefinitionOptions\n readonly unwrappedCode: Function\n readonly uri: string\n\n getInvocationParameters: (\n options: IGetInvocationDataRequest\n ) => Promise<IGetInvocationDataResponse>\n}\n\nexport default abstract class Definition {\n public readonly code: Function\n public readonly id: string\n public readonly line: number\n public readonly options: IDefinitionOptions\n public readonly unwrappedCode: Function\n public readonly uri: string\n\n constructor({\n code,\n id,\n line,\n options,\n unwrappedCode,\n uri,\n }: IDefinitionParameters<IDefinitionOptions>) {\n this.code = code\n this.id = id\n this.line = line\n this.options = options\n this.unwrappedCode = unwrappedCode\n this.uri = uri\n }\n\n buildInvalidCodeLengthMessage(\n syncOrPromiseLength: number | string,\n callbackLength: number | string\n ): string {\n return (\n `function has ${this.code.length.toString()} arguments` +\n `, should have ${syncOrPromiseLength.toString()} (if synchronous or returning a promise)` +\n ` or ${callbackLength.toString()} (if accepting a callback)`\n )\n }\n\n baseGetInvalidCodeLengthMessage(parameters: any[]): string {\n return this.buildInvalidCodeLengthMessage(\n parameters.length,\n parameters.length + 1\n )\n }\n}\n"]}
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/models/definition.ts"],"names":[],"mappings":";;AAuDA,MAA8B,UAAU;IAQtC,YAAY,EACV,IAAI,EACJ,EAAE,EACF,IAAI,EACJ,OAAO,EACP,aAAa,EACb,GAAG,GACuC;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,6BAA6B,CAC3B,mBAAoC,EACpC,cAA+B;QAE/B,OAAO,CACL,gBAAgB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY;YACvD,iBAAiB,mBAAmB,CAAC,QAAQ,EAAE,0CAA0C;YACzF,OAAO,cAAc,CAAC,QAAQ,EAAE,4BAA4B,CAC7D,CAAA;IACH,CAAC;IAED,+BAA+B,CAAC,UAAiB;QAC/C,OAAO,IAAI,CAAC,6BAA6B,CACvC,UAAU,CAAC,MAAM,EACjB,UAAU,CAAC,MAAM,GAAG,CAAC,CACtB,CAAA;IACH,CAAC;CACF;AAzCD,6BAyCC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { ITestCaseHookParameter } from '../support_code_library_builder/types'\nimport { Expression } from '@cucumber/cucumber-expressions'\nimport { GherkinStepKeyword } from './gherkin_step_keyword'\n\nexport interface IGetInvocationDataRequest {\n hookParameter: ITestCaseHookParameter\n step: messages.PickleStep\n world: any\n}\n\nexport interface IGetInvocationDataResponse {\n getInvalidCodeLengthMessage: () => string\n parameters: any[]\n validCodeLengths: number[]\n}\n\nexport interface IDefinitionOptions {\n timeout?: number\n wrapperOptions?: any\n}\n\nexport interface IHookDefinitionOptions extends IDefinitionOptions {\n name?: string\n tags?: string\n}\n\nexport interface IDefinitionParameters<T extends IDefinitionOptions> {\n code: Function\n id: string\n line: number\n options: T\n unwrappedCode?: Function\n uri: string\n}\n\nexport interface IStepDefinitionParameters extends IDefinitionParameters<IDefinitionOptions> {\n keyword: GherkinStepKeyword\n pattern: string | RegExp\n expression: Expression\n}\n\nexport interface IDefinition {\n readonly code: Function\n readonly id: string\n readonly line: number\n readonly options: IDefinitionOptions\n readonly unwrappedCode: Function\n readonly uri: string\n\n getInvocationParameters: (\n options: IGetInvocationDataRequest\n ) => Promise<IGetInvocationDataResponse>\n}\n\nexport default abstract class Definition {\n public readonly code: Function\n public readonly id: string\n public readonly line: number\n public readonly options: IDefinitionOptions\n public readonly unwrappedCode: Function\n public readonly uri: string\n\n constructor({\n code,\n id,\n line,\n options,\n unwrappedCode,\n uri,\n }: IDefinitionParameters<IDefinitionOptions>) {\n this.code = code\n this.id = id\n this.line = line\n this.options = options\n this.unwrappedCode = unwrappedCode\n this.uri = uri\n }\n\n buildInvalidCodeLengthMessage(\n syncOrPromiseLength: number | string,\n callbackLength: number | string\n ): string {\n return (\n `function has ${this.code.length.toString()} arguments` +\n `, should have ${syncOrPromiseLength.toString()} (if synchronous or returning a promise)` +\n ` or ${callbackLength.toString()} (if accepting a callback)`\n )\n }\n\n baseGetInvalidCodeLengthMessage(parameters: any[]): string {\n return this.buildInvalidCodeLengthMessage(\n parameters.length,\n parameters.length + 1\n )\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import * as messages from '@cucumber/messages';
2
- import IGherkinDocument = messages.GherkinDocument;
3
- import IPickle = messages.Pickle;
2
+ type IGherkinDocument = messages.GherkinDocument;
3
+ type IPickle = messages.Pickle;
4
4
  export interface IPickleFilterOptions {
5
5
  cwd: string;
6
6
  featurePaths?: string[];
@@ -40,3 +40,4 @@ export declare class PickleTagFilter {
40
40
  constructor(tagExpression: string);
41
41
  matchesAllTagExpressions(pickle: messages.Pickle): boolean;
42
42
  }
43
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"pickle_filter.js","sourceRoot":"","sources":["../src/pickle_filter.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,gFAA6C;AAC7C,yFAA2F;AAC3F,mDAAiE;AAKjE,MAAM,sBAAsB,GAAG,uBAAuB,CAAA;AActD,MAAqB,YAAY;IAK/B,YAAY,EACV,GAAG,EACH,YAAY,EACZ,KAAK,EACL,aAAa,GACQ;QACrB,IAAI,CAAC,UAAU,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;QACzD,IAAI,CAAC,UAAU,GAAG,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAA;QAC7C,IAAI,CAAC,SAAS,GAAG,IAAI,eAAe,CAAC,aAAa,CAAC,CAAA;IACrD,CAAC;IAED,OAAO,CAAC,EACN,eAAe,EACf,MAAM,GAIP;QACC,OAAO,CACL,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC;YAC3D,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC;YACtC,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAChD,CAAA;IACH,CAAC;CACF;AA7BD,+BA6BC;AAED,MAAa,gBAAgB;IAG3B,YAAY,GAAW,EAAE,eAAyB,EAAE;QAClD,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,2BAA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gCAAgB,EAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE;YAC5C,OAAO,IAAI,CAAA;SACZ;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACxE,CAAC;CACF;AAfD,0CAeC","sourcesContent":["import path from 'path'\nimport parse from '@cucumber/tag-expressions'\nimport { getGherkinScenarioLocationMap } from './formatter/helpers/gherkin_document_parser'\nimport { doesHaveValue, doesNotHaveValue } from './value_checker'\nimport * as messages from '@cucumber/messages'\nimport IGherkinDocument = messages.GherkinDocument\nimport IPickle = messages.Pickle\n\nconst FEATURE_LINENUM_REGEXP = /^(.*?)((?::[\\d]+)+)?$/\n\nexport interface IPickleFilterOptions {\n cwd: string\n featurePaths?: string[]\n names?: string[]\n tagExpression?: string\n}\n\nexport interface IMatchesAnyLineRequest {\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n}\n\nexport default class PickleFilter {\n private readonly lineFilter: PickleLineFilter\n private readonly nameFilter: PickleNameFilter\n private readonly tagFilter: PickleTagFilter\n\n constructor({\n cwd,\n featurePaths,\n names,\n tagExpression,\n }: IPickleFilterOptions) {\n this.lineFilter = new PickleLineFilter(cwd, featurePaths)\n this.nameFilter = new PickleNameFilter(names)\n this.tagFilter = new PickleTagFilter(tagExpression)\n }\n\n matches({\n gherkinDocument,\n pickle,\n }: {\n gherkinDocument: IGherkinDocument\n pickle: IPickle\n }): boolean {\n return (\n this.lineFilter.matchesAnyLine({ gherkinDocument, pickle }) &&\n this.nameFilter.matchesAnyName(pickle) &&\n this.tagFilter.matchesAllTagExpressions(pickle)\n )\n }\n}\n\nexport class PickleLineFilter {\n private readonly featureUriToLinesMapping: Record<string, number[]>\n\n constructor(cwd: string, featurePaths: string[] = []) {\n this.featureUriToLinesMapping = this.getFeatureUriToLinesMapping({\n cwd,\n featurePaths,\n })\n }\n\n getFeatureUriToLinesMapping({\n cwd,\n featurePaths,\n }: {\n cwd: string\n featurePaths: string[]\n }): Record<string, number[]> {\n const mapping: Record<string, number[]> = {}\n featurePaths.forEach((featurePath) => {\n const match = FEATURE_LINENUM_REGEXP.exec(featurePath)\n if (doesHaveValue(match)) {\n let uri = match[1]\n if (path.isAbsolute(uri)) {\n uri = path.relative(cwd, uri)\n } else {\n uri = path.normalize(uri)\n }\n const linesExpression = match[2]\n if (doesHaveValue(linesExpression)) {\n if (doesNotHaveValue(mapping[uri])) {\n mapping[uri] = []\n }\n linesExpression\n .slice(1)\n .split(':')\n .forEach((line) => {\n mapping[uri].push(parseInt(line))\n })\n }\n }\n })\n return mapping\n }\n\n matchesAnyLine({ gherkinDocument, pickle }: IMatchesAnyLineRequest): boolean {\n const uri = path.normalize(pickle.uri)\n const linesToMatch = this.featureUriToLinesMapping[uri]\n if (doesHaveValue(linesToMatch)) {\n const gherkinScenarioLocationMap =\n getGherkinScenarioLocationMap(gherkinDocument)\n const pickleLines = new Set(\n pickle.astNodeIds.map(\n (sourceId) => gherkinScenarioLocationMap[sourceId].line\n )\n )\n const linesIntersection = linesToMatch.filter((x) => pickleLines.has(x))\n return linesIntersection.length > 0\n }\n return true\n }\n}\n\nexport class PickleNameFilter {\n private readonly names: string[]\n\n constructor(names: string[] = []) {\n this.names = names\n }\n\n matchesAnyName(pickle: messages.Pickle): boolean {\n if (this.names.length === 0) {\n return true\n }\n return this.names.some((name) => pickle.name.match(name))\n }\n}\n\nexport class PickleTagFilter {\n private readonly tagExpressionNode: any // cucumber-tag-expressions does not export interface\n\n constructor(tagExpression: string) {\n if (doesHaveValue(tagExpression) && tagExpression !== '') {\n this.tagExpressionNode = parse(tagExpression)\n }\n }\n\n matchesAllTagExpressions(pickle: messages.Pickle): boolean {\n if (doesNotHaveValue(this.tagExpressionNode)) {\n return true\n }\n return this.tagExpressionNode.evaluate(pickle.tags.map((x) => x.name))\n }\n}\n"]}
1
+ {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,CACF,CAAA;YACD,MAAM,iBAAiB,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;YACxE,OAAO,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAA;SACpC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA5DD,4CA4DC;AAED,MAAa,gBAAgB;IAG3B,YAAY,QAAkB,EAAE;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,cAAc,CAAC,MAAuB;QACpC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAA;SACZ;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IAC3D,CAAC;CACF;AAbD,4CAaC;AAED,MAAa,eAAe;IAG1B,YAAY,aAAqB;QAC/B,IAAI,IAAA,6BAAa,EAAC,aAAa,CAAC,IAAI,aAAa,KAAK,EAAE,EAAE;YACxD,IAAI,CAAC,iBAAiB,GAAG,IAAA,yBAAK,EAAC,aAAa,CAAC,CAAA;SAC9C;IACH,CAAC;IAED,wBAAwB,CAAC,MAAuB;QAC9C,IAAI,IAAA,gCAAgB,EAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE;YAC5C,OAAO,IAAI,CAAA;SACZ;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACxE,CAAC;CACF;AAfD,0CAeC","sourcesContent":["import path from 'path'\nimport parse from '@cucumber/tag-expressions'\nimport { getGherkinScenarioLocationMap } from './formatter/helpers/gherkin_document_parser'\nimport { doesHaveValue, doesNotHaveValue } from './value_checker'\nimport * as messages from '@cucumber/messages'\ntype IGherkinDocument = messages.GherkinDocument\ntype IPickle = messages.Pickle\n\nconst FEATURE_LINENUM_REGEXP = /^(.*?)((?::[\\d]+)+)?$/\n\nexport interface IPickleFilterOptions {\n cwd: string\n featurePaths?: string[]\n names?: string[]\n tagExpression?: string\n}\n\nexport interface IMatchesAnyLineRequest {\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n}\n\nexport default class PickleFilter {\n private readonly lineFilter: PickleLineFilter\n private readonly nameFilter: PickleNameFilter\n private readonly tagFilter: PickleTagFilter\n\n constructor({\n cwd,\n featurePaths,\n names,\n tagExpression,\n }: IPickleFilterOptions) {\n this.lineFilter = new PickleLineFilter(cwd, featurePaths)\n this.nameFilter = new PickleNameFilter(names)\n this.tagFilter = new PickleTagFilter(tagExpression)\n }\n\n matches({\n gherkinDocument,\n pickle,\n }: {\n gherkinDocument: IGherkinDocument\n pickle: IPickle\n }): boolean {\n return (\n this.lineFilter.matchesAnyLine({ gherkinDocument, pickle }) &&\n this.nameFilter.matchesAnyName(pickle) &&\n this.tagFilter.matchesAllTagExpressions(pickle)\n )\n }\n}\n\nexport class PickleLineFilter {\n private readonly featureUriToLinesMapping: Record<string, number[]>\n\n constructor(cwd: string, featurePaths: string[] = []) {\n this.featureUriToLinesMapping = this.getFeatureUriToLinesMapping({\n cwd,\n featurePaths,\n })\n }\n\n getFeatureUriToLinesMapping({\n cwd,\n featurePaths,\n }: {\n cwd: string\n featurePaths: string[]\n }): Record<string, number[]> {\n const mapping: Record<string, number[]> = {}\n featurePaths.forEach((featurePath) => {\n const match = FEATURE_LINENUM_REGEXP.exec(featurePath)\n if (doesHaveValue(match)) {\n let uri = match[1]\n if (path.isAbsolute(uri)) {\n uri = path.relative(cwd, uri)\n } else {\n uri = path.normalize(uri)\n }\n const linesExpression = match[2]\n if (doesHaveValue(linesExpression)) {\n if (doesNotHaveValue(mapping[uri])) {\n mapping[uri] = []\n }\n linesExpression\n .slice(1)\n .split(':')\n .forEach((line) => {\n mapping[uri].push(parseInt(line))\n })\n }\n }\n })\n return mapping\n }\n\n matchesAnyLine({ gherkinDocument, pickle }: IMatchesAnyLineRequest): boolean {\n const uri = path.normalize(pickle.uri)\n const linesToMatch = this.featureUriToLinesMapping[uri]\n if (doesHaveValue(linesToMatch)) {\n const gherkinScenarioLocationMap =\n getGherkinScenarioLocationMap(gherkinDocument)\n const pickleLines = new Set(\n pickle.astNodeIds.map(\n (sourceId) => gherkinScenarioLocationMap[sourceId].line\n )\n )\n const linesIntersection = linesToMatch.filter((x) => pickleLines.has(x))\n return linesIntersection.length > 0\n }\n return true\n }\n}\n\nexport class PickleNameFilter {\n private readonly names: string[]\n\n constructor(names: string[] = []) {\n this.names = names\n }\n\n matchesAnyName(pickle: messages.Pickle): boolean {\n if (this.names.length === 0) {\n return true\n }\n return this.names.some((name) => pickle.name.match(name))\n }\n}\n\nexport class PickleTagFilter {\n private readonly tagExpressionNode: any // cucumber-tag-expressions does not export interface\n\n constructor(tagExpression: string) {\n if (doesHaveValue(tagExpression) && tagExpression !== '') {\n this.tagExpressionNode = parse(tagExpression)\n }\n }\n\n matchesAllTagExpressions(pickle: messages.Pickle): boolean {\n if (doesNotHaveValue(this.tagExpressionNode)) {\n return true\n }\n return this.tagExpressionNode.evaluate(pickle.tags.map((x) => x.name))\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"world.js","sourceRoot":"","sources":["../../src/support_code_library_builder/world.ts"],"names":[],"mappings":";;AAgBA,MAAqB,KAAK;IAOxB,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAiC;QACpE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;CACF;AAZD,wBAYC","sourcesContent":["import { ICreateAttachment, ICreateLog } from '../runtime/attachment_manager'\n\nexport interface IWorldOptions<ParametersType = any> {\n attach: ICreateAttachment\n log: ICreateLog\n parameters: ParametersType\n}\n\nexport interface IWorld<ParametersType = any> {\n readonly attach: ICreateAttachment\n readonly log: ICreateLog\n readonly parameters: ParametersType\n\n [key: string]: any\n}\n\nexport default class World<ParametersType = any>\n implements IWorld<ParametersType>\n{\n public readonly attach: ICreateAttachment\n public readonly log: ICreateLog\n public readonly parameters: ParametersType\n\n constructor({ attach, log, parameters }: IWorldOptions<ParametersType>) {\n this.attach = attach\n this.log = log\n this.parameters = parameters\n }\n}\n"]}
1
+ {"version":3,"file":"world.js","sourceRoot":"","sources":["../../src/support_code_library_builder/world.ts"],"names":[],"mappings":";;AAgBA,MAAqB,KAAK;IAOxB,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAiC;QACpE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;CACF;AAZD,wBAYC","sourcesContent":["import { ICreateAttachment, ICreateLog } from '../runtime/attachment_manager'\n\nexport interface IWorldOptions<ParametersType = any> {\n attach: ICreateAttachment\n log: ICreateLog\n parameters: ParametersType\n}\n\nexport interface IWorld<ParametersType = any> {\n readonly attach: ICreateAttachment\n readonly log: ICreateLog\n readonly parameters: ParametersType\n\n [key: string]: any\n}\n\nexport default class World<\n ParametersType = any,\n> implements IWorld<ParametersType> {\n public readonly attach: ICreateAttachment\n public readonly log: ICreateLog\n public readonly parameters: ParametersType\n\n constructor({ attach, log, parameters }: IWorldOptions<ParametersType>) {\n this.attach = attach\n this.log = log\n this.parameters = parameters\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import UncaughtExceptionListener = NodeJS.UncaughtExceptionListener;
2
+ type UncaughtExceptionListener = NodeJS.UncaughtExceptionListener;
3
3
  declare const UncaughtExceptionManager: {
4
4
  registerHandler(handler: UncaughtExceptionListener): void;
5
5
  unregisterHandler(handler: UncaughtExceptionListener): void;
@@ -1 +1 @@
1
- {"version":3,"file":"uncaught_exception_manager.js","sourceRoot":"","sources":["../src/uncaught_exception_manager.ts"],"names":[],"mappings":";;AAEA,MAAM,wBAAwB,GAAG;IAC/B,eAAe,CAAC,OAAkC;QAChD,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;IAED,iBAAiB,CAAC,OAAkC;QAClD,OAAO,CAAC,cAAc,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAA;IACtD,CAAC;CACF,CAAA;AAED,kBAAe,wBAAwB,CAAA","sourcesContent":["import UncaughtExceptionListener = NodeJS.UncaughtExceptionListener\n\nconst UncaughtExceptionManager = {\n registerHandler(handler: UncaughtExceptionListener): void {\n process.addListener('uncaughtException', handler)\n },\n\n unregisterHandler(handler: UncaughtExceptionListener): void {\n process.removeListener('uncaughtException', handler)\n },\n}\n\nexport default UncaughtExceptionManager\n"]}
1
+ {"version":3,"file":"uncaught_exception_manager.js","sourceRoot":"","sources":["../src/uncaught_exception_manager.ts"],"names":[],"mappings":";;AAEA,MAAM,wBAAwB,GAAG;IAC/B,eAAe,CAAC,OAAkC;QAChD,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;IAED,iBAAiB,CAAC,OAAkC;QAClD,OAAO,CAAC,cAAc,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAA;IACtD,CAAC;CACF,CAAA;AAED,kBAAe,wBAAwB,CAAA","sourcesContent":["type UncaughtExceptionListener = NodeJS.UncaughtExceptionListener\n\nconst UncaughtExceptionManager = {\n registerHandler(handler: UncaughtExceptionListener): void {\n process.addListener('uncaughtException', handler)\n },\n\n unregisterHandler(handler: UncaughtExceptionListener): void {\n process.removeListener('uncaughtException', handler)\n },\n}\n\nexport default UncaughtExceptionManager\n"]}
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "1.0.122";
1
+ export declare const version = "1.0.123-stage";
package/lib/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // Generated by genversion.
5
- exports.version = '1.0.122';
5
+ exports.version = '1.0.123-stage';
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,SAAS,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '1.0.122'\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,eAAe,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '1.0.123-stage'\n"]}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "gherkin",
9
9
  "tests"
10
10
  ],
11
- "version": "1.0.122",
11
+ "version": "1.0.123-stage",
12
12
  "homepage": "https://github.com/blinq-io/cucumber-js",
13
13
  "author": "blinq.io",
14
14
  "contributors": [
@@ -85,6 +85,7 @@
85
85
  "mkdirp": "^2.1.5",
86
86
  "mz": "^2.7.0",
87
87
  "object-path": "^0.11.8",
88
+ "p-limit": "^7.2.0",
88
89
  "progress": "^2.0.3",
89
90
  "resolve-pkg": "^2.0.0",
90
91
  "semver": "7.5.3",