@dev-blinq/cucumber_client 1.0.1526-dev → 1.0.1527-dev

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.
@@ -68,7 +68,7 @@ class PromisifiedSocketServer {
68
68
  }
69
69
  }
70
70
 
71
- const init = ({ envName, projectDir, roomId, TOKEN }) => {
71
+ async function init({ envName, projectDir, roomId, TOKEN }) {
72
72
  console.log("Connecting to " + WS_URL);
73
73
  const socket = io(WS_URL);
74
74
  socketLogger.init(socket, { context: "BVTRecorder", eventName: "BVTRecorder.log" });
@@ -291,38 +291,35 @@ const init = ({ envName, projectDir, roomId, TOKEN }) => {
291
291
  return recorder.stopRecordingNetwork(input);
292
292
  },
293
293
  });
294
+
294
295
  socket.on("targetBrowser.command.event", async (input) => {
295
296
  return recorder.onAction(input);
296
297
  });
297
298
  promisifiedSocketServer.init();
298
- };
299
+ }
300
+
301
+ const isMainModule = import.meta.url === `file://${process.argv[1]}`;
299
302
 
300
- const usage = `Usage: node bvt_recorder.js <projectDir> <envName> <roomId>`;
301
- const args = loadArgs();
302
- const projectDir = args[0];
303
- const envName = args[1].split("=")[1];
304
- const roomId = args[2];
305
- const shouldTakeScreenshot = args[3];
306
- const TOKEN = process.env.TOKEN;
307
- try {
308
- validateCLIArg(projectDir, "projectDir");
309
- validateCLIArg(envName, "envName");
310
- validateCLIArg(roomId, "roomId");
311
- validateCLIArg(shouldTakeScreenshot, "shouldTakeScreenshot");
312
- if (!TOKEN) {
313
- throw new Error("TOKEN env variable not set");
303
+ if (isMainModule) {
304
+ const usage = `Usage: node bvt_recorder.js <projectDir> <envName> <roomId>`;
305
+ const args = loadArgs();
306
+ const projectDir = args[0];
307
+ const envName = args[1].split("=")[1];
308
+ const roomId = args[2];
309
+ const shouldTakeScreenshot = args[3];
310
+ const TOKEN = process.env.TOKEN;
311
+
312
+ try {
313
+ validateCLIArg(projectDir, "projectDir");
314
+ validateCLIArg(envName, "envName");
315
+ validateCLIArg(roomId, "roomId");
316
+ validateCLIArg(shouldTakeScreenshot, "shouldTakeScreenshot");
317
+ if (!TOKEN) {
318
+ throw new Error("TOKEN env variable not set");
319
+ }
320
+ } catch (error) {
321
+ showUsage(error, usage);
314
322
  }
315
- } catch (error) {
316
- showUsage(error, usage);
317
- }
318
- try {
319
- init({
320
- envName,
321
- projectDir,
322
- roomId,
323
- TOKEN,
324
- shouldTakeScreenshot: shouldTakeScreenshot ? shouldTakeScreenshot === "true" : false,
325
- });
326
- } catch (error) {
327
- console.error(error);
328
323
  }
324
+
325
+ export { init as BVTRecorderInit };
package/bin/index.js CHANGED
@@ -14,3 +14,4 @@ export * from "./client/cucumber/steps_definitions.js";
14
14
  export * from "./client/profiler.js";
15
15
  export * from "./client/code_cleanup/utils.js";
16
16
  export * from "./client/code_cleanup/find_step_definition_references.js";
17
+ export * from "./client/recorderv3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1526-dev",
3
+ "version": "1.0.1527-dev",
4
4
  "description": " ",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",