@automatify-au/cli 0.1.4 → 0.1.5
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.
- package/README.md +3 -0
- package/dist/automatify.cjs +45 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -94,7 +94,9 @@ All TestOps commands are invoked as `automatify testops <command>`:
|
|
|
94
94
|
- `automatify testops bdd scenarios export --id <SCENARIO_ID|SC-4> --output-dir ./scenario-export`
|
|
95
95
|
- `automatify testops bdd scenarios export --all --output-dir ./scenario-export`
|
|
96
96
|
- `automatify testops bdd scenarios import --file ./scenario-export/SC-4.feature`
|
|
97
|
+
- `automatify testops bdd scenarios import --file ./scenario-export/SC-4.feature --dry-run`
|
|
97
98
|
- `automatify testops bdd scenarios import --input-dir ./scenario-export`
|
|
99
|
+
- `automatify testops bdd scenarios import --input-dir ./scenario-export --dry-run`
|
|
98
100
|
- `automatify testops bdd features export --output-dir ./features-export`
|
|
99
101
|
- `automatify testops bdd features export --output-dir ./features-export --zip`
|
|
100
102
|
- `automatify testops bdd features export --output-dir ./features-export --feature-id <FEATURE_ID>`
|
|
@@ -307,6 +309,7 @@ automatify testops bdd scenarios import --project-key DEV --file ./artifacts/sce
|
|
|
307
309
|
|
|
308
310
|
# Export every visible SC-* file and import the whole folder back later
|
|
309
311
|
automatify testops bdd scenarios export --project-key DEV --all --output-dir ./artifacts/scenario-bulk
|
|
312
|
+
automatify testops bdd scenarios import --project-key DEV --input-dir ./artifacts/scenario-bulk --dry-run
|
|
310
313
|
automatify testops bdd scenarios import --project-key DEV --input-dir ./artifacts/scenario-bulk
|
|
311
314
|
|
|
312
315
|
# Re-import one exported file later
|
package/dist/automatify.cjs
CHANGED
|
@@ -2761,7 +2761,7 @@ function parseArgs2(args) {
|
|
|
2761
2761
|
"--file",
|
|
2762
2762
|
...CONFIG_FLAGS2
|
|
2763
2763
|
]);
|
|
2764
|
-
const supportedBoolFlags = /* @__PURE__ */ new Set(["--json", "--zip", "--all"]);
|
|
2764
|
+
const supportedBoolFlags = /* @__PURE__ */ new Set(["--json", "--zip", "--all", "--dry-run"]);
|
|
2765
2765
|
for (let index = 0; index < args.length; index += 1) {
|
|
2766
2766
|
const token = args[index];
|
|
2767
2767
|
if (!token.startsWith("--")) {
|
|
@@ -3278,6 +3278,7 @@ function createBddHandler(deps = {}) {
|
|
|
3278
3278
|
if (nested === "import") {
|
|
3279
3279
|
const sourceFile = parsed.flags["--file"] ? import_node_path6.default.resolve(cwd, parsed.flags["--file"]) : "";
|
|
3280
3280
|
const inputDir = parsed.flags["--input-dir"] ? import_node_path6.default.resolve(cwd, parsed.flags["--input-dir"]) : "";
|
|
3281
|
+
const dryRun = parsed.boolFlags.has("--dry-run");
|
|
3281
3282
|
if (!sourceFile && !inputDir) {
|
|
3282
3283
|
return {
|
|
3283
3284
|
exitCode: ExitCode.ValidationError,
|
|
@@ -3318,6 +3319,7 @@ function createBddHandler(deps = {}) {
|
|
|
3318
3319
|
};
|
|
3319
3320
|
}
|
|
3320
3321
|
const updatedItems = [];
|
|
3322
|
+
const plannedItems = [];
|
|
3321
3323
|
for (const entry of parsedScenarios) {
|
|
3322
3324
|
const parsedScenario = entry.parsed;
|
|
3323
3325
|
const scenario = scenariosResult.data.find(
|
|
@@ -3330,6 +3332,19 @@ function createBddHandler(deps = {}) {
|
|
|
3330
3332
|
};
|
|
3331
3333
|
}
|
|
3332
3334
|
const nextTags = parsedScenario.tags.filter((tag) => !SCENARIO_METADATA_PATTERN.test(tag));
|
|
3335
|
+
if (dryRun) {
|
|
3336
|
+
plannedItems.push({
|
|
3337
|
+
file: entry.filePath,
|
|
3338
|
+
scenarioId: scenario.id,
|
|
3339
|
+
scenarioKey: scenario.key ?? null,
|
|
3340
|
+
featureName: parsedScenario.featureName,
|
|
3341
|
+
scenarioName: parsedScenario.scenarioName,
|
|
3342
|
+
tags: [...nextTags],
|
|
3343
|
+
linkedIssueKeys: [...parsedScenario.linkedIssueKeys],
|
|
3344
|
+
steps: [...parsedScenario.steps]
|
|
3345
|
+
});
|
|
3346
|
+
continue;
|
|
3347
|
+
}
|
|
3333
3348
|
const updateResult = await context.invokeForgeContract("updateScenario", {
|
|
3334
3349
|
context: {
|
|
3335
3350
|
projectKey,
|
|
@@ -3362,16 +3377,43 @@ function createBddHandler(deps = {}) {
|
|
|
3362
3377
|
action: "bdd-scenarios-import",
|
|
3363
3378
|
projectKey,
|
|
3364
3379
|
issueKey: issueKey || null,
|
|
3365
|
-
|
|
3380
|
+
dryRun,
|
|
3381
|
+
count: dryRun ? plannedItems.length : updatedItems.length,
|
|
3366
3382
|
file: sourceFile || null,
|
|
3367
3383
|
inputDir: inputDir || null,
|
|
3368
|
-
items:
|
|
3384
|
+
items: dryRun ? plannedItems.map((entry) => ({
|
|
3385
|
+
file: entry.file,
|
|
3386
|
+
scenarioId: entry.scenarioId,
|
|
3387
|
+
scenarioKey: entry.scenarioKey,
|
|
3388
|
+
featureName: entry.featureName,
|
|
3389
|
+
scenarioName: entry.scenarioName,
|
|
3390
|
+
tags: [...entry.tags],
|
|
3391
|
+
linkedIssueKeys: [...entry.linkedIssueKeys],
|
|
3392
|
+
steps: entry.steps.map((step) => ({
|
|
3393
|
+
keyword: step.keyword,
|
|
3394
|
+
text: step.text
|
|
3395
|
+
}))
|
|
3396
|
+
})) : updatedItems.map((entry) => ({
|
|
3369
3397
|
file: entry.file,
|
|
3370
3398
|
item: toJsonScenario(entry.item)
|
|
3371
3399
|
}))
|
|
3372
3400
|
})
|
|
3373
3401
|
};
|
|
3374
3402
|
}
|
|
3403
|
+
if (dryRun) {
|
|
3404
|
+
return {
|
|
3405
|
+
exitCode: ExitCode.Success,
|
|
3406
|
+
stdout: plannedItems.flatMap((entry) => [
|
|
3407
|
+
`BDD scenario import dry-run: ${entry.scenarioKey ?? entry.scenarioId}`,
|
|
3408
|
+
`Source: ${entry.file}`,
|
|
3409
|
+
`Feature: ${entry.featureName}`,
|
|
3410
|
+
`Scenario: ${entry.scenarioName}`,
|
|
3411
|
+
`Tags: ${entry.tags.length > 0 ? entry.tags.join(", ") : "none"}`,
|
|
3412
|
+
`Linked issues: ${entry.linkedIssueKeys.length > 0 ? entry.linkedIssueKeys.join(", ") : "none"}`,
|
|
3413
|
+
...entry.steps.map((step) => ` ${step.keyword} ${step.text}`)
|
|
3414
|
+
])
|
|
3415
|
+
};
|
|
3416
|
+
}
|
|
3375
3417
|
return {
|
|
3376
3418
|
exitCode: ExitCode.Success,
|
|
3377
3419
|
stdout: updatedItems.flatMap((entry) => [
|