allure 3.13.2 → 3.14.1

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.
@@ -5,6 +5,11 @@ export declare const formatAgentInspectCommand: (params: {
5
5
  resultsDir?: string[];
6
6
  }) => string;
7
7
  export declare const printAgentOutputLinks: (outputDir: string) => void;
8
+ export declare const printAgentRunStart: (outputDir: string, commandString: string) => void;
9
+ export declare const printAgentRunSummary: (outputDir: string, options?: {
10
+ durationMs?: number;
11
+ rerunCommand?: string;
12
+ }) => Promise<void>;
8
13
  export declare const persistAgentRunState: (value: Parameters<typeof writeAgentRunState>[0]) => Promise<void>;
9
14
  export declare const cleanupManagedAgentOutputs: (params: {
10
15
  cwd: string;
@@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
5
5
  import { join, resolve } from "node:path";
6
6
  import process, { exit } from "node:process";
7
7
  import { AllureReport, isFileNotFoundError, readConfig } from "@allurereport/core";
8
- import { createAgentTestPlanContext, AgentUsageError, formatAgentOutputLinks, isPathInside, normalizeAgentRerunPreset, parseAgentLabelFilters, cleanupAgentRunState, cleanupStaleAgentRunStates, resolveAgentStateDir, writeAgentRunState, } from "@allurereport/plugin-agent";
8
+ import { createAgentTestPlanContext, AgentUsageError, assertExplicitAgentOutputDirIsSafe, formatAgentOutputLinks, formatAgentRunSummary, isPathInside, loadAgentOutput, normalizeAgentRerunPreset, parseAgentLabelFilters, cleanupAgentRunState, cleanupStaleAgentRunStates, resolveAgentStateDir, writeAgentRunState, } from "@allurereport/plugin-agent";
9
9
  import { normalizeCommandEnvironmentOptions, resolveCommandEnvironment } from "../utils/environment.js";
10
10
  import { createChildAllureCliEnvironment, getActiveAllureCliCommand } from "../utils/execution-context.js";
11
11
  import { findAllureResultDirectories, findFilesByGlobs } from "../utils/fileSystem.js";
@@ -24,6 +24,29 @@ export const printAgentOutputLinks = (outputDir) => {
24
24
  console.log(line);
25
25
  }
26
26
  };
27
+ export const printAgentRunStart = (outputDir, commandString) => {
28
+ console.log(`agent output: ${outputDir}`);
29
+ console.log(commandString);
30
+ console.log("live: read manifest/test-events.jsonl (appended per test) in that directory to watch progress before the run finishes");
31
+ };
32
+ export const printAgentRunSummary = async (outputDir, options = {}) => {
33
+ try {
34
+ const bundle = await loadAgentOutput(outputDir);
35
+ const summary = formatAgentRunSummary({
36
+ outputDir,
37
+ run: bundle.run,
38
+ humanReport: bundle.humanReport,
39
+ durationMs: options.durationMs,
40
+ rerunCommand: options.rerunCommand,
41
+ });
42
+ for (const line of summary) {
43
+ console.log(line);
44
+ }
45
+ }
46
+ catch {
47
+ printAgentOutputLinks(outputDir);
48
+ }
49
+ };
27
50
  export const persistAgentRunState = async (value) => {
28
51
  try {
29
52
  await writeAgentRunState(value);
@@ -89,6 +112,8 @@ export const executeAgentMode = async (params) => {
89
112
  ...createChildAllureCliEnvironment("agent"),
90
113
  ...(rerunContext ? { ALLURE_TESTPLAN_PATH: rerunContext.testPlanPath } : {}),
91
114
  };
115
+ let resolvedExitCode = -1;
116
+ let runCompleted = false;
92
117
  try {
93
118
  if (getActiveAllureCliCommand()) {
94
119
  console.log(commandString);
@@ -99,7 +124,8 @@ export const executeAgentMode = async (params) => {
99
124
  ...(rerunContext ? { environmentVariables: { ALLURE_TESTPLAN_PATH: rerunContext.testPlanPath } } : {}),
100
125
  silent,
101
126
  });
102
- exit(exitCode ?? -1);
127
+ resolvedExitCode = exitCode ?? -1;
128
+ runCompleted = true;
103
129
  return;
104
130
  }
105
131
  const runId = randomUUID();
@@ -114,6 +140,9 @@ export const executeAgentMode = async (params) => {
114
140
  if (expectationsPath && isPathInside(outputDir, expectationsPath)) {
115
141
  throw new AgentUsageError(`--expectations path ${JSON.stringify(expectationsPath)} must not be inside the agent output directory ${JSON.stringify(outputDir)}`);
116
142
  }
143
+ if (!managedOutput) {
144
+ await assertExplicitAgentOutputDirIsSafe(outputDir);
145
+ }
117
146
  const humanReport = await createAgentHumanReportConfig({
118
147
  mode: reportMode,
119
148
  cwd,
@@ -155,14 +184,7 @@ export const executeAgentMode = async (params) => {
155
184
  status: "running",
156
185
  pid: process.pid,
157
186
  });
158
- printAgentOutputLinks(outputDir);
159
- if (expectationsPath) {
160
- console.log(`agent expectations: ${expectationsPath}`);
161
- }
162
- else if (inlineExpectations) {
163
- console.log("agent expectations: CLI options");
164
- }
165
- console.log(commandString);
187
+ printAgentRunStart(outputDir, commandString);
166
188
  const allureReport = new AllureReport({
167
189
  ...config,
168
190
  output: outputDir,
@@ -185,7 +207,7 @@ export const executeAgentMode = async (params) => {
185
207
  environment: resolvedEnvironment?.id,
186
208
  withQualityGate: false,
187
209
  logs: "pipe",
188
- silent,
210
+ silent: true,
189
211
  ignoreLogs: false,
190
212
  logProcessExit: false,
191
213
  });
@@ -203,10 +225,15 @@ export const executeAgentMode = async (params) => {
203
225
  pid: process.pid,
204
226
  });
205
227
  await cleanupManagedAgentOutputs({ cwd, runId, managedOutput });
206
- exit(globalExitCode.actual ?? globalExitCode.original);
228
+ await printAgentRunSummary(outputDir, { durationMs: Date.now() - startedAt, rerunCommand: commandString });
229
+ resolvedExitCode = globalExitCode.actual ?? globalExitCode.original;
230
+ runCompleted = true;
207
231
  }
208
232
  finally {
209
233
  await rerunContext?.cleanup();
234
+ if (runCompleted) {
235
+ exit(resolvedExitCode);
236
+ }
210
237
  }
211
238
  };
212
239
  export const executeAgentInspectMode = async (params) => {
@@ -238,6 +265,9 @@ export const executeAgentInspectMode = async (params) => {
238
265
  if (expectationsPath && isPathInside(outputDir, expectationsPath)) {
239
266
  throw new AgentUsageError(`--expectations path ${JSON.stringify(expectationsPath)} must not be inside the agent output directory ${JSON.stringify(outputDir)}`);
240
267
  }
268
+ if (!managedOutput) {
269
+ await assertExplicitAgentOutputDirIsSafe(outputDir);
270
+ }
241
271
  const historyLimitValue = historyLimit ? parseInt(historyLimit, 10) : undefined;
242
272
  const humanReport = await createAgentHumanReportConfig({
243
273
  mode: reportMode,
@@ -292,13 +322,6 @@ export const executeAgentInspectMode = async (params) => {
292
322
  status: "running",
293
323
  pid: process.pid,
294
324
  });
295
- printAgentOutputLinks(outputDir);
296
- if (expectationsPath) {
297
- console.log(`agent expectations: ${expectationsPath}`);
298
- }
299
- else if (inlineExpectations) {
300
- console.log("agent expectations: CLI options");
301
- }
302
325
  console.log(commandString);
303
326
  const allureReport = new AllureReport({
304
327
  ...config,
@@ -331,5 +354,6 @@ export const executeAgentInspectMode = async (params) => {
331
354
  pid: process.pid,
332
355
  });
333
356
  await cleanupManagedAgentOutputs({ cwd, runId, managedOutput });
357
+ await printAgentRunSummary(outputDir, { durationMs: Date.now() - startedAt });
334
358
  exit(0);
335
359
  };
@@ -4,7 +4,7 @@ import { mkdir, mkdtemp, realpath, writeFile } from "node:fs/promises";
4
4
  import { tmpdir } from "node:os";
5
5
  import { dirname, join, resolve } from "node:path";
6
6
  import process, { exit } from "node:process";
7
- import { AGENT_FINDING_CATEGORIES, AGENT_FINDING_SEVERITIES, AGENT_TASK_MAP_HELP, AGENT_TEST_STATUSES, AgentExpectationUsageError, buildAgentInlineExpectations, buildAgentQueryPayload, cleanupAgentRunState, cleanupStaleAgentRunStates, createAgentCapabilities, formatAgentOutputLinks, isAgentExpectationUsageError, isAgentTaskMapHelpRequest, isAgentUsageError, loadAgentOutput, normalizeAgentQueryLimit, normalizeAgentQueryView, normalizeAgentRerunPreset, normalizeRepeatedEnumValues, normalizeRepeatedStringValues, parseAgentLabelFilters, readLatestAgentState, resolveAgentSelectionOutputDir, resolveAgentStateDir, selectAgentTestPlan, validateAgentExpectationsFile, writeAgentRunState, writeInvalidAgentExpectationOutput, } from "@allurereport/plugin-agent";
7
+ import { AGENT_FINDING_CATEGORIES, AGENT_FINDING_SEVERITIES, AGENT_TASK_MAP_HELP, AGENT_TEST_STATUSES, AgentExpectationUsageError, assertExplicitAgentOutputDirIsSafe, buildAgentInlineExpectations, buildAgentQueryPayload, cleanupAgentRunState, cleanupStaleAgentRunStates, createAgentCapabilities, formatAgentOutputLinks, isAgentExpectationUsageError, isAgentTaskMapHelpRequest, isAgentUsageError, loadAgentOutput, normalizeAgentQueryLimit, normalizeAgentQueryView, normalizeAgentRerunPreset, normalizeRepeatedEnumValues, normalizeRepeatedStringValues, parseAgentLabelFilters, readLatestAgentState, resolveAgentSelectionOutputDir, resolveAgentStateDir, selectAgentTestPlan, validateAgentExpectationsFile, writeAgentRunState, writeInvalidAgentExpectationOutput, } from "@allurereport/plugin-agent";
8
8
  import { Command, Option, UsageError } from "clipanion";
9
9
  export { AGENT_TASK_MAP_HELP, createAgentCapabilities, isAgentTaskMapHelpRequest };
10
10
  const readOptionalString = (value) => (typeof value === "string" ? value : undefined);
@@ -208,6 +208,9 @@ export class AgentCommand extends Command {
208
208
  throw new UsageError("expecting command to be specified after --, e.g. allure agent -- npm run test");
209
209
  }
210
210
  try {
211
+ if (output) {
212
+ await assertExplicitAgentOutputDirIsSafe(resolve(await realpath(configuredCwd ?? process.cwd()), output));
213
+ }
211
214
  const inlineExpectations = buildInlineExpectationsFromOptions({
212
215
  goal: this.goal,
213
216
  taskId: this.taskId,
@@ -389,6 +392,9 @@ export class AgentInspectCommand extends Command {
389
392
  throw new UsageError("agent inspect does not run commands; pass result directories directly, e.g. allure agent inspect ./allure-results");
390
393
  }
391
394
  try {
395
+ if (output) {
396
+ await assertExplicitAgentOutputDirIsSafe(resolve(await realpath(configuredCwd ?? process.cwd()), output));
397
+ }
392
398
  const inlineExpectations = buildInlineExpectationsFromOptions({
393
399
  goal: this.goal,
394
400
  taskId: this.taskId,
@@ -502,12 +508,13 @@ export class AgentLatestCommand extends Command {
502
508
  latestState = await readLatestAgentState(cwd);
503
509
  }
504
510
  catch (error) {
505
- console.error(`Could not read the latest agent output for ${cwd}: ${error.message}`);
511
+ console.error(`Could not read the latest Allure agent output for ${cwd}: ${error.message}. ` +
512
+ "Check the state directory printed by `allure agent state-dir`, or set ALLURE_AGENT_STATE_DIR to a writable path.");
506
513
  exit(1);
507
514
  return;
508
515
  }
509
516
  if (!latestState) {
510
- console.error(`No latest agent output found for ${cwd}`);
517
+ console.error(`No recorded Allure agent output for ${cwd}. Run \`allure agent <command>\` first to create one.`);
511
518
  exit(1);
512
519
  return;
513
520
  }
@@ -678,7 +685,9 @@ export class AgentSelectCommand extends Command {
678
685
  labelFilters: parseAgentLabelFilters(labels),
679
686
  });
680
687
  if (!selection.testPlan.tests.length) {
681
- console.error(`No tests matched selection in ${selection.outputDir}`);
688
+ console.error(`No tests matched selection in ${selection.outputDir}. ` +
689
+ "Adjust --preset (review|failed|unsuccessful|all), --label, or --environment, " +
690
+ "or pick a different run with --from/--latest.");
682
691
  exit(1);
683
692
  return;
684
693
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allure",
3
- "version": "3.13.2",
3
+ "version": "3.14.1",
4
4
  "description": "Allure Commandline Tool",
5
5
  "keywords": [
6
6
  "allure",
@@ -32,26 +32,26 @@
32
32
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
33
33
  },
34
34
  "dependencies": {
35
- "@allurereport/charts-api": "3.13.2",
36
- "@allurereport/ci": "3.13.2",
37
- "@allurereport/core": "3.13.2",
38
- "@allurereport/core-api": "3.13.2",
39
- "@allurereport/directory-watcher": "3.13.2",
40
- "@allurereport/plugin-agent": "3.13.2",
41
- "@allurereport/plugin-allure2": "3.13.2",
42
- "@allurereport/plugin-api": "3.13.2",
43
- "@allurereport/plugin-awesome": "3.13.2",
44
- "@allurereport/plugin-classic": "3.13.2",
45
- "@allurereport/plugin-csv": "3.13.2",
46
- "@allurereport/plugin-dashboard": "3.13.2",
47
- "@allurereport/plugin-jira": "3.13.2",
48
- "@allurereport/plugin-log": "3.13.2",
49
- "@allurereport/plugin-progress": "3.13.2",
50
- "@allurereport/plugin-server-reload": "3.13.2",
51
- "@allurereport/plugin-slack": "3.13.2",
52
- "@allurereport/reader-api": "3.13.2",
53
- "@allurereport/service": "3.13.2",
54
- "@allurereport/static-server": "3.13.2",
35
+ "@allurereport/charts-api": "3.14.1",
36
+ "@allurereport/ci": "3.14.1",
37
+ "@allurereport/core": "3.14.1",
38
+ "@allurereport/core-api": "3.14.1",
39
+ "@allurereport/directory-watcher": "3.14.1",
40
+ "@allurereport/plugin-agent": "3.14.1",
41
+ "@allurereport/plugin-allure2": "3.14.1",
42
+ "@allurereport/plugin-api": "3.14.1",
43
+ "@allurereport/plugin-awesome": "3.14.1",
44
+ "@allurereport/plugin-classic": "3.14.1",
45
+ "@allurereport/plugin-csv": "3.14.1",
46
+ "@allurereport/plugin-dashboard": "3.14.1",
47
+ "@allurereport/plugin-jira": "3.14.1",
48
+ "@allurereport/plugin-log": "3.14.1",
49
+ "@allurereport/plugin-progress": "3.14.1",
50
+ "@allurereport/plugin-server-reload": "3.14.1",
51
+ "@allurereport/plugin-slack": "3.14.1",
52
+ "@allurereport/reader-api": "3.14.1",
53
+ "@allurereport/service": "3.14.1",
54
+ "@allurereport/static-server": "3.14.1",
55
55
  "adm-zip": "^0.5.16",
56
56
  "clipanion": "^4.0.0-rc.4",
57
57
  "glob": "^13.0.6",