@dev-blinq/cucumber_client 1.0.1729-dev → 1.0.1731-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.
@@ -898,63 +898,70 @@ export async function updateStepDefinitions({ scenario, featureName, projectDir,
898
898
 
899
899
  stepsDefinitions.load(false);
900
900
 
901
- for (const step of steps) {
902
- if (step.internalImplementedStepId) {
903
- const si = steps.findIndex((s) => s.id === step.internalImplementedStepId);
904
- if (si !== -1) {
905
- step.isImplementedWhileRecording = true;
901
+ steps.forEach(async (step, index) => {
902
+ try {
903
+ if (step.internalImplementedStepId) {
904
+ const si = steps.findIndex((s) => s.id === step.internalImplementedStepId);
905
+ if (si !== -1) {
906
+ step.isImplementedWhileRecording = true;
907
+ }
906
908
  }
907
- }
908
909
 
909
- if (!step.isUtilStep && ((step.isImplemented && !step.shouldOverride) || step.commands.length === 0)) {
910
- let routesPath = path.join(tmpdir(), `blinq_temp_routes`);
911
- if (process.env.TEMP_RUN === "true") {
912
- if (existsSync(routesPath)) rmSync(routesPath, { recursive: true });
913
- mkdirSync(routesPath, { recursive: true });
914
- saveRoutes({ step, folderPath: routesPath }, logger);
915
- } else {
916
- if (existsSync(routesPath)) {
917
- try {
918
- rmSync(routesPath, { recursive: true });
919
- } catch (error) {
920
- logger.error(`❌ Error removing temp routes folder: ${getErrorMessage(error)}`);
910
+ if (!step.isUtilStep && ((step.isImplemented && !step.shouldOverride) || step.commands.length === 0)) {
911
+ let routesPath = path.join(tmpdir(), `blinq_temp_routes`);
912
+ if (process.env.TEMP_RUN === "true") {
913
+ if (existsSync(routesPath)) rmSync(routesPath, { recursive: true });
914
+ mkdirSync(routesPath, { recursive: true });
915
+ saveRoutes({ step, folderPath: routesPath }, logger);
916
+ } else {
917
+ if (existsSync(routesPath)) {
918
+ try {
919
+ rmSync(routesPath, { recursive: true });
920
+ } catch (error) {
921
+ logger.error(`❌ Error removing temp routes folder: ${getErrorMessage(error)}`);
922
+ }
921
923
  }
924
+ routesPath = path.join(projectDir, "data", "routes");
925
+ if (!existsSync(routesPath)) mkdirSync(routesPath, { recursive: true });
926
+ saveRoutes({ step, folderPath: routesPath }, logger);
922
927
  }
923
- routesPath = path.join(projectDir, "data", "routes");
924
- if (!existsSync(routesPath)) mkdirSync(routesPath, { recursive: true });
925
- saveRoutes({ step, folderPath: routesPath }, logger);
926
- }
927
-
928
- if (step.commands && Array.isArray(step.commands)) {
929
- step.commands = step.commands.map((cmd) => toRecordingStep(cmd, scenario.parametersMap));
930
- }
931
-
932
- continue;
933
- }
934
928
 
935
- const cucumberStep = getCucumberStep({ step });
936
- const pageName = generatePageName(step.startFrame?.url ?? "default", step.isUtilStep);
937
- const stepDefsFilePath = locateDefinitionPath(featureFolder, pageName);
938
- let codePage = getCodePage(stepDefsFilePath);
939
-
940
- codePage = await saveRecording({
941
- step,
942
- cucumberStep,
943
- codePage,
944
- projectDir,
945
- stepsDefinitions,
946
- parametersMap: scenario.parametersMap,
947
- });
929
+ if (step.commands && Array.isArray(step.commands)) {
930
+ step.commands = step.commands.map((cmd) => toRecordingStep(cmd, scenario.parametersMap));
931
+ }
948
932
 
949
- if (!codePage) continue;
933
+ return;
934
+ }
950
935
 
951
- const res = await codePage.save();
952
- if (!res) {
936
+ const cucumberStep = getCucumberStep({ step });
937
+ const pageName = generatePageName(step.startFrame?.url ?? "default", step.isUtilStep);
938
+ const stepDefsFilePath = locateDefinitionPath(featureFolder, pageName);
939
+ let codePage = getCodePage(stepDefsFilePath);
940
+
941
+ codePage = await saveRecording({
942
+ step,
943
+ cucumberStep,
944
+ codePage,
945
+ projectDir,
946
+ stepsDefinitions,
947
+ parametersMap: scenario.parametersMap,
948
+ });
949
+
950
+ if (!codePage) return;
951
+
952
+ const res = await codePage.save();
953
+ if (!res) {
954
+ throw new DomainError(
955
+ `Failed to save step definition for "${cucumberStep.text}" in "${codePage.sourceFileName}"`
956
+ );
957
+ }
958
+ } catch (error) {
959
+ logger.error(`❌ Failed to update step definition for step "${step.text}": ${getErrorMessage(error)}`);
953
960
  throw new DomainError(
954
- `Failed to save step definition for "${cucumberStep.text}" in "${codePage.sourceFileName}"`
961
+ `Failed to update step definition for step "${step.text}" at index ${index}: ${getErrorMessage(error)}`
955
962
  );
956
963
  }
957
- }
964
+ });
958
965
 
959
966
  writeFileSync(utilsFilePath, utilsContent, "utf8");
960
967
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1729-dev",
3
+ "version": "1.0.1731-dev",
4
4
  "description": " ",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",