@dev-blinq/cucumber_client 1.0.1472-stage → 1.0.1473-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.
|
@@ -866,6 +866,7 @@ export async function executeStep({ stepsDefinitions, cucumberStep, context, cod
|
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
868
|
|
|
869
|
+
// deprecated
|
|
869
870
|
export async function updateStepDefinitionsOld({ scenario, featureName, projectDir, logger }) {
|
|
870
871
|
// set the candidate step definition file name
|
|
871
872
|
// set the utils file path
|
|
@@ -950,7 +951,8 @@ export async function updateStepDefinitionsOld({ scenario, featureName, projectD
|
|
|
950
951
|
|
|
951
952
|
export async function updateStepDefinitions({ scenario, featureName, projectDir, logger, bvtSnapshotsDir }) {
|
|
952
953
|
try {
|
|
953
|
-
|
|
954
|
+
logger.info("🔵 Starting updateStepDefinitions()");
|
|
955
|
+
const { featureFolder, utilsFilePath, utilsContent } = handleFileInitOps(projectDir, logger);
|
|
954
956
|
const steps = scenario.steps;
|
|
955
957
|
|
|
956
958
|
const stepsDefinitions = new StepsDefinitions(projectDir);
|
|
@@ -1064,12 +1066,26 @@ export async function updateStepDefinitions({ scenario, featureName, projectDir,
|
|
|
1064
1066
|
|
|
1065
1067
|
writeFileSync(utilsFilePath, utilsContent, UTF8_ENCODING);
|
|
1066
1068
|
} catch (error) {
|
|
1067
|
-
logger.error(
|
|
1069
|
+
logger.error(
|
|
1070
|
+
"❌ updateStepDefinitions() failed" +
|
|
1071
|
+
JSON.stringify(
|
|
1072
|
+
{
|
|
1073
|
+
message: error?.message,
|
|
1074
|
+
meta: error?.meta,
|
|
1075
|
+
stack: error?.stack,
|
|
1076
|
+
},
|
|
1077
|
+
null,
|
|
1078
|
+
2
|
|
1079
|
+
) +
|
|
1080
|
+
"\nStringified error: ❌" +
|
|
1081
|
+
getErrorMessage(error)
|
|
1082
|
+
);
|
|
1068
1083
|
throw error instanceof UpdateStepDefinitionsError
|
|
1069
1084
|
? error
|
|
1070
1085
|
: new UpdateStepDefinitionsError({
|
|
1071
1086
|
type: SaveJobErrorType.INTERNAL_ERROR,
|
|
1072
1087
|
message: error?.message ?? "Unknown error",
|
|
1088
|
+
meta: error.meta,
|
|
1073
1089
|
});
|
|
1074
1090
|
}
|
|
1075
1091
|
}
|
|
@@ -8,8 +8,10 @@ import {
|
|
|
8
8
|
UpdateStepDefinitionsError,
|
|
9
9
|
UTF8_ENCODING,
|
|
10
10
|
} from "./constants.js";
|
|
11
|
+
import url from "node:url";
|
|
12
|
+
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
11
13
|
|
|
12
|
-
export function handleFileInitOps(projectDir) {
|
|
14
|
+
export function handleFileInitOps(projectDir, logger) {
|
|
13
15
|
try {
|
|
14
16
|
const stepDefinitionFolderPath = path.join(
|
|
15
17
|
projectDir,
|
|
@@ -26,13 +28,17 @@ export function handleFileInitOps(projectDir) {
|
|
|
26
28
|
FIXED_FOLDER_NAMES.STEP_DEFINITIONS,
|
|
27
29
|
FIXED_FILE_NAMES.UTILS
|
|
28
30
|
);
|
|
29
|
-
|
|
30
31
|
const utilsTemplateFilePath = path.join(
|
|
31
32
|
__dirname,
|
|
32
33
|
`../../${FIXED_FOLDER_NAMES.ASSETS}`,
|
|
33
34
|
FIXED_FOLDER_NAMES.TEMPLATES,
|
|
34
35
|
FIXED_FILE_NAMES.UTILS_TEMPLATE
|
|
35
36
|
);
|
|
37
|
+
|
|
38
|
+
if (!existsSync(utilsTemplateFilePath)) {
|
|
39
|
+
throw new Error(`Utils template not found at: ${utilsTemplateFilePath}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
36
42
|
const utilsContent = readFileSync(utilsTemplateFilePath, UTF8_ENCODING);
|
|
37
43
|
writeFileSync(utilsFilePath, utilsContent, UTF8_ENCODING);
|
|
38
44
|
|
|
@@ -54,7 +60,7 @@ export function handleFileInitOps(projectDir) {
|
|
|
54
60
|
} catch (error) {
|
|
55
61
|
throw new UpdateStepDefinitionsError({
|
|
56
62
|
type: SaveJobErrorType.FILE_SYSTEM_ERROR,
|
|
57
|
-
message: "Failed to initialize step definition folder structure",
|
|
63
|
+
message: "❌ Failed to initialize step definition folder structure",
|
|
58
64
|
meta: { reason: getErrorMessage(error) },
|
|
59
65
|
});
|
|
60
66
|
}
|