@dev-blinq/cucumber_client 1.0.1257-dev → 1.0.1259-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.
@@ -1,6 +1,7 @@
1
1
  import { existsSync, readFileSync, writeFileSync } from "fs";
2
2
  import path from "path";
3
-
3
+ import { getDefaultPrettierConfig } from "../code_cleanup/utils.js";
4
+ import prettier from "prettier";
4
5
  export function containsScenario({ featureFileContent, scenarioName }) {
5
6
  const lines = featureFileContent.split("\n");
6
7
  for (const line of lines) {
@@ -333,6 +334,8 @@ export async function updateFeatureFile({ featureName, scenario, override, proje
333
334
  { scenario },
334
335
  isFeatureFileExists ? GherkinToObject(readFileSync(featureFilePath, "utf8")) : undefined
335
336
  );
337
+ const prettierConfig = getDefaultPrettierConfig();
338
+ // Format the code using Prettier
336
339
 
337
340
  if (isFeatureFileExists) {
338
341
  const featureFileContent = readFileSync(featureFilePath, "utf8");
@@ -341,7 +344,7 @@ export async function updateFeatureFile({ featureName, scenario, override, proje
341
344
  if (!override) {
342
345
  throw new Error(`Scenario "${scenario.name}" already exists in feature "${featureName}"`);
343
346
  } else {
344
- const updatedFeatureFileContent = updateExistingScenario({
347
+ let updatedFeatureFileContent = updateExistingScenario({
345
348
  featureFileContent,
346
349
  scenarioName: scenario.name,
347
350
  scenarioContent,
@@ -349,14 +352,17 @@ export async function updateFeatureFile({ featureName, scenario, override, proje
349
352
  if (updatedFeatureFileContent === "error") {
350
353
  throw new Error(`Error while parsing feature file: Invalid gherkin`);
351
354
  }
355
+ updatedFeatureFileContent = await prettier.format(updatedFeatureFileContent, prettierConfig);
352
356
  writeFileSync(featureFilePath, updatedFeatureFileContent);
353
357
  return;
354
358
  }
355
359
  }
356
- const updatedFeatureFileContent = featureFileContent + "\n" + scenarioContent;
360
+ let updatedFeatureFileContent = featureFileContent + "\n" + scenarioContent;
361
+ updatedFeatureFileContent = await prettier.format(updatedFeatureFileContent, prettierConfig);
357
362
  writeFileSync(featureFilePath, updatedFeatureFileContent);
358
363
  } else {
359
- const featureFileContent = `Feature: ${featureName}\n${scenarioContent}`;
364
+ let featureFileContent = `Feature: ${featureName}\n${scenarioContent}`;
365
+ featureFileContent = await prettier.format(featureFileContent, prettierConfig);
360
366
  writeFileSync(featureFilePath, featureFileContent);
361
367
  }
362
368
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1257-dev",
3
+ "version": "1.0.1259-dev",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "@cucumber/tag-expressions": "^6.1.1",
32
32
  "@dev-blinq/cucumber-js": "1.0.173-dev",
33
33
  "@faker-js/faker": "^8.1.0",
34
- "automation_model": "1.0.748-dev",
34
+ "automation_model": "1.0.750-dev",
35
35
  "axios": "^1.7.4",
36
36
  "chokidar": "^3.6.0",
37
37
  "create-require": "^1.1.1",
@@ -46,6 +46,7 @@
46
46
  "patch-package": "^8.0.0",
47
47
  "playwright-core": "1.52.0",
48
48
  "prettier": "^3.2.5",
49
+ "prettier-plugin-gherkin": "^3.1.2",
49
50
  "pureimage": "0.4.9",
50
51
  "socket.io": "^4.7.5",
51
52
  "socket.io-client": "^4.7.5",