allure 3.0.0-beta.2 → 3.0.0-beta.20

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.
Files changed (66) hide show
  1. package/README.md +148 -16
  2. package/dist/commands/allure2.d.ts +15 -0
  3. package/dist/commands/allure2.js +77 -0
  4. package/dist/commands/awesome.d.ts +18 -12
  5. package/dist/commands/awesome.js +83 -75
  6. package/dist/commands/classic.d.ts +15 -11
  7. package/dist/commands/classic.js +71 -63
  8. package/dist/commands/csv.d.ts +13 -9
  9. package/dist/commands/csv.js +63 -45
  10. package/dist/commands/dashboard.d.ts +15 -0
  11. package/dist/commands/dashboard.js +77 -0
  12. package/dist/commands/generate.d.ts +12 -9
  13. package/dist/commands/generate.js +99 -26
  14. package/dist/commands/history.d.ts +9 -7
  15. package/dist/commands/history.js +32 -29
  16. package/dist/commands/index.d.ts +7 -0
  17. package/dist/commands/index.js +7 -0
  18. package/dist/commands/knownIssue.d.ts +8 -6
  19. package/dist/commands/knownIssue.js +31 -20
  20. package/dist/commands/log.d.ts +12 -7
  21. package/dist/commands/log.js +58 -40
  22. package/dist/commands/login.d.ts +8 -0
  23. package/dist/commands/login.js +50 -0
  24. package/dist/commands/logout.d.ts +8 -0
  25. package/dist/commands/logout.js +50 -0
  26. package/dist/commands/open.d.ts +11 -8
  27. package/dist/commands/open.js +36 -36
  28. package/dist/commands/projects/create.d.ts +9 -0
  29. package/dist/commands/projects/create.js +83 -0
  30. package/dist/commands/projects/delete.d.ts +10 -0
  31. package/dist/commands/projects/delete.js +68 -0
  32. package/dist/commands/projects/index.d.ts +3 -0
  33. package/dist/commands/projects/index.js +3 -0
  34. package/dist/commands/projects/list.d.ts +8 -0
  35. package/dist/commands/projects/list.js +75 -0
  36. package/dist/commands/qualityGate.d.ts +14 -6
  37. package/dist/commands/qualityGate.js +126 -39
  38. package/dist/commands/results/index.d.ts +2 -0
  39. package/dist/commands/results/index.js +2 -0
  40. package/dist/commands/results/pack.d.ts +10 -0
  41. package/dist/commands/results/pack.js +106 -0
  42. package/dist/commands/results/unpack.d.ts +9 -0
  43. package/dist/commands/results/unpack.js +79 -0
  44. package/dist/commands/run.d.ts +24 -10
  45. package/dist/commands/run.js +279 -109
  46. package/dist/commands/slack.d.ts +9 -5
  47. package/dist/commands/slack.js +55 -31
  48. package/dist/commands/testplan.d.ts +8 -6
  49. package/dist/commands/testplan.js +38 -30
  50. package/dist/commands/watch.d.ts +12 -10
  51. package/dist/commands/watch.js +110 -106
  52. package/dist/commands/whoami.d.ts +8 -0
  53. package/dist/commands/whoami.js +57 -0
  54. package/dist/index.d.ts +1 -2
  55. package/dist/index.js +34 -28
  56. package/dist/utils/index.d.ts +1 -0
  57. package/dist/utils/index.js +1 -0
  58. package/dist/utils/logs.d.ts +3 -0
  59. package/dist/utils/logs.js +32 -0
  60. package/dist/utils/process.d.ts +8 -2
  61. package/dist/utils/process.js +17 -6
  62. package/dist/utils/terminal.d.ts +1 -1
  63. package/dist/utils/terminal.js +1 -1
  64. package/package.json +33 -15
  65. package/dist/utils/commands.d.ts +0 -16
  66. package/dist/utils/commands.js +0 -14
@@ -1,9 +1,13 @@
1
- type CsvCommandOptions = {
2
- separator?: string;
3
- disableHeaders?: boolean;
4
- output?: string;
5
- knownIssues?: string;
6
- };
7
- export declare const CsvCommandAction: (resultsDir: string, options: CsvCommandOptions) => Promise<void>;
8
- export declare const CsvCommand: (cli: import("cac").CAC) => void;
9
- export {};
1
+ import { Command } from "clipanion";
2
+ export declare class CsvCommand extends Command {
3
+ static paths: string[][];
4
+ static usage: import("clipanion").Usage;
5
+ resultsDir: string;
6
+ config: string | undefined;
7
+ cwd: string | undefined;
8
+ output: string | undefined;
9
+ disableHeaders: boolean | undefined;
10
+ separator: string | undefined;
11
+ knownIssues: string | undefined;
12
+ execute(): Promise<void>;
13
+ }
@@ -1,51 +1,69 @@
1
- import { AllureReport, resolveConfig } from "@allure/core";
2
- import { createCommand } from "../utils/commands.js";
3
- export const CsvCommandAction = async (resultsDir, options) => {
4
- const before = new Date().getTime();
5
- const config = await resolveConfig({
6
- plugins: {
7
- "@allure/plugin-csv": {
8
- options,
9
- },
10
- },
11
- });
12
- const allureReport = new AllureReport(config);
13
- await allureReport.start();
14
- await allureReport.readDirectory(resultsDir);
15
- await allureReport.done();
16
- const after = new Date().getTime();
17
- console.log(`the report successfully generated (${after - before}ms)`);
18
- };
19
- export const CsvCommand = createCommand({
20
- name: "csv <resultsDir>",
21
- description: "Generates CSV report based on provided Allure Results",
22
- options: [
23
- [
24
- "--output, -o <file>",
25
- {
26
- description: "The output file name. Absolute paths are accepted as well",
27
- default: "allure.csv",
28
- },
29
- ],
30
- [
31
- "--disable-headers",
1
+ import { AllureReport, readConfig } from "@allurereport/core";
2
+ import CsvPlugin from "@allurereport/plugin-csv";
3
+ import { Command, Option } from "clipanion";
4
+ import * as console from "node:console";
5
+ import { realpath } from "node:fs/promises";
6
+ import process from "node:process";
7
+ export class CsvCommand extends Command {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.resultsDir = Option.String({ required: true, name: "The directory with Allure results" });
11
+ this.config = Option.String("--config,-c", {
12
+ description: "The path Allure config file",
13
+ });
14
+ this.cwd = Option.String("--cwd", {
15
+ description: "The working directory for the command to run (default: current working directory)",
16
+ });
17
+ this.output = Option.String("--output,-o", {
18
+ description: "The output file name. Absolute paths are accepted as well",
19
+ });
20
+ this.disableHeaders = Option.Boolean("--disable-headers", {
21
+ description: "Specify, to disable CSV headers",
22
+ });
23
+ this.separator = Option.String("--separator", {
24
+ description: "The csv separator",
25
+ });
26
+ this.knownIssues = Option.String("--known-issues", {
27
+ description: "Path to the known issues file. Updates the file and quarantines failed tests when specified",
28
+ });
29
+ }
30
+ async execute() {
31
+ const cwd = await realpath(this.cwd ?? process.cwd());
32
+ const before = new Date().getTime();
33
+ const defaultCsvOptions = {
34
+ separator: this.separator ?? ",",
35
+ disableHeaders: this.disableHeaders ?? false,
36
+ };
37
+ const config = await readConfig(cwd, this.config, {
38
+ output: this.output ?? "allure.csv",
39
+ knownIssuesPath: this.knownIssues,
40
+ });
41
+ config.plugins = [
32
42
  {
33
- description: "Specify, to disable CSV headers",
43
+ id: "csv",
44
+ enabled: true,
45
+ options: defaultCsvOptions,
46
+ plugin: new CsvPlugin(defaultCsvOptions),
34
47
  },
35
- ],
36
- [
37
- "--separator <string>",
38
- {
39
- description: "The csv separator",
40
- default: ",",
41
- },
42
- ],
48
+ ];
49
+ const allureReport = new AllureReport(config);
50
+ await allureReport.start();
51
+ await allureReport.readDirectory(this.resultsDir);
52
+ await allureReport.done();
53
+ const after = new Date().getTime();
54
+ console.log(`the report successfully generated (${after - before}ms)`);
55
+ }
56
+ }
57
+ CsvCommand.paths = [["csv"]];
58
+ CsvCommand.usage = Command.Usage({
59
+ category: "Reports",
60
+ description: "Generates CSV report based on provided Allure Results",
61
+ details: "This command generates a CSV report from the provided Allure Results directory.",
62
+ examples: [
63
+ ["csv ./allure-results", "Generate a report from the ./allure-results directory"],
43
64
  [
44
- "--known-issues <file>",
45
- {
46
- description: "Path to the known issues file. Updates the file and quarantines failed tests when specified",
47
- },
65
+ "csv ./allure-results --output custom-report.csv",
66
+ "Generate a report from the ./allure-results directory to the custom-report.csv file",
48
67
  ],
49
68
  ],
50
- action: CsvCommandAction,
51
69
  });
@@ -0,0 +1,15 @@
1
+ import { Command } from "clipanion";
2
+ export declare class DashboardCommand extends Command {
3
+ static paths: string[][];
4
+ static usage: import("clipanion").Usage;
5
+ resultsDir: string;
6
+ config: string | undefined;
7
+ cwd: string | undefined;
8
+ output: string | undefined;
9
+ reportName: string | undefined;
10
+ singleFile: boolean | undefined;
11
+ logo: string | undefined;
12
+ theme: string | undefined;
13
+ reportLanguage: string | undefined;
14
+ execute(): Promise<void>;
15
+ }
@@ -0,0 +1,77 @@
1
+ import { AllureReport, readConfig } from "@allurereport/core";
2
+ import DashboardPlugin from "@allurereport/plugin-dashboard";
3
+ import { Command, Option } from "clipanion";
4
+ import * as console from "node:console";
5
+ import { realpath } from "node:fs/promises";
6
+ import process from "node:process";
7
+ export class DashboardCommand extends Command {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.resultsDir = Option.String({ required: true, name: "The directory with Allure results" });
11
+ this.config = Option.String("--config,-c", {
12
+ description: "The path Allure config file",
13
+ });
14
+ this.cwd = Option.String("--cwd", {
15
+ description: "The working directory for the command to run (default: current working directory)",
16
+ });
17
+ this.output = Option.String("--output,-o", {
18
+ description: "The output directory name. Absolute paths are accepted as well",
19
+ });
20
+ this.reportName = Option.String("--report-name,--name", {
21
+ description: "The report name",
22
+ });
23
+ this.singleFile = Option.Boolean("--single-file", {
24
+ description: "Generate single file report",
25
+ });
26
+ this.logo = Option.String("--logo", {
27
+ description: "Path to the report logo which will be displayed in the header",
28
+ });
29
+ this.theme = Option.String("--theme", {
30
+ description: "Default theme of the report (default: OS theme)",
31
+ });
32
+ this.reportLanguage = Option.String("--report-language,--lang", {
33
+ description: "Default language of the report (default: OS language)",
34
+ });
35
+ }
36
+ async execute() {
37
+ const cwd = await realpath(this.cwd ?? process.cwd());
38
+ const before = new Date().getTime();
39
+ const defaultDashboardOptions = {
40
+ singleFile: this.singleFile ?? false,
41
+ logo: this.logo,
42
+ theme: this.theme,
43
+ reportLanguage: this.reportLanguage ?? "en",
44
+ };
45
+ const config = await readConfig(cwd, this.config, {
46
+ output: this.output ?? "allure-report",
47
+ name: this.reportName ?? "Allure Report",
48
+ });
49
+ config.plugins = [
50
+ {
51
+ id: "dashboard",
52
+ enabled: true,
53
+ options: defaultDashboardOptions,
54
+ plugin: new DashboardPlugin(defaultDashboardOptions),
55
+ },
56
+ ];
57
+ const allureReport = new AllureReport(config);
58
+ await allureReport.start();
59
+ await allureReport.readDirectory(this.resultsDir);
60
+ await allureReport.done();
61
+ const after = new Date().getTime();
62
+ console.log(`the report successfully generated (${after - before}ms)`);
63
+ }
64
+ }
65
+ DashboardCommand.paths = [["dashboard"]];
66
+ DashboardCommand.usage = Command.Usage({
67
+ category: "Reports",
68
+ description: "Generates Allure Dashboard report based on provided Allure Results",
69
+ details: "This command generates an Allure Dashboard report from the provided Allure Results directory.",
70
+ examples: [
71
+ ["dashboard ./allure-results", "Generate a report from the ./allure-results directory"],
72
+ [
73
+ "dashboard ./allure-results --output custom-report",
74
+ "Generate a report from the ./allure-results directory to the custom-report directory",
75
+ ],
76
+ ],
77
+ });
@@ -1,9 +1,12 @@
1
- type CommandOptions = {
2
- config?: string;
3
- output?: string;
4
- cwd?: string;
5
- reportName?: string;
6
- };
7
- export declare const GenerateCommandAction: (resultsDir: string, options: CommandOptions) => Promise<void>;
8
- export declare const GenerateCommand: (cli: import("cac").CAC) => void;
9
- export {};
1
+ import { Command } from "clipanion";
2
+ export declare class GenerateCommand extends Command {
3
+ static paths: string[][];
4
+ static usage: import("clipanion").Usage;
5
+ resultsDir: string | undefined;
6
+ config: string | undefined;
7
+ output: string | undefined;
8
+ cwd: string | undefined;
9
+ reportName: string | undefined;
10
+ stage: string[] | undefined;
11
+ execute(): Promise<void>;
12
+ }
@@ -1,35 +1,108 @@
1
- import { AllureReport, readRuntimeConfig } from "@allure/core";
2
- import { createCommand } from "../utils/commands.js";
3
- export const GenerateCommandAction = async (resultsDir, options) => {
4
- const { config: configPath, output, cwd, reportName } = options;
5
- const config = await readRuntimeConfig(configPath, cwd, output, reportName);
6
- const allureReport = new AllureReport(config);
7
- await allureReport.start();
8
- await allureReport.readDirectory(resultsDir);
9
- await allureReport.done();
10
- };
11
- export const GenerateCommand = createCommand({
12
- name: "generate <resultsDir>",
1
+ import { AllureReport, readConfig } from "@allurereport/core";
2
+ import { KnownError } from "@allurereport/service";
3
+ import { Command, Option } from "clipanion";
4
+ import { glob } from "glob";
5
+ import * as console from "node:console";
6
+ import { sep } from "node:path";
7
+ import { exit, cwd as processCwd } from "node:process";
8
+ import { red } from "yoctocolors";
9
+ import { logError } from "../utils/logs.js";
10
+ export class GenerateCommand extends Command {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.resultsDir = Option.String({
14
+ required: false,
15
+ name: "Pattern to match test results directories in the current working directory (default: ./**/allure-results)",
16
+ });
17
+ this.config = Option.String("--config,-c", {
18
+ description: "The path Allure config file",
19
+ });
20
+ this.output = Option.String("--output,-o", {
21
+ description: "The output directory name. Absolute paths are accepted as well (default: allure-report)",
22
+ });
23
+ this.cwd = Option.String("--cwd", {
24
+ description: "The working directory for the command to run (default: current working directory)",
25
+ });
26
+ this.reportName = Option.String("--report-name,--name", {
27
+ description: "The report name (default: Allure Report)",
28
+ });
29
+ this.stage = Option.Array("--stage", {
30
+ description: "Stages archives to restore state from (default: empty string)",
31
+ });
32
+ }
33
+ async execute() {
34
+ const cwd = this.cwd ?? processCwd();
35
+ const resultsDir = (this.resultsDir ?? "./**/allure-results").replace(/[\\/]$/, "");
36
+ const config = await readConfig(cwd, this.config, {
37
+ name: this.reportName,
38
+ output: this.output ?? "allure-report",
39
+ });
40
+ const stageDumpFiles = [];
41
+ const resultsDirectories = [];
42
+ if (this.stage?.length) {
43
+ for (const stage of this.stage) {
44
+ const matchedFiles = await glob(stage, {
45
+ nodir: true,
46
+ dot: true,
47
+ absolute: true,
48
+ windowsPathsNoEscape: true,
49
+ cwd,
50
+ });
51
+ stageDumpFiles.push(...matchedFiles);
52
+ }
53
+ }
54
+ if (!!this.resultsDir || stageDumpFiles.length === 0) {
55
+ const matchedDirs = (await glob(resultsDir, {
56
+ mark: true,
57
+ nodir: false,
58
+ absolute: true,
59
+ dot: true,
60
+ windowsPathsNoEscape: true,
61
+ cwd,
62
+ })).filter((p) => p.endsWith(sep));
63
+ resultsDirectories.push(...matchedDirs);
64
+ }
65
+ if (resultsDirectories.length === 0 && stageDumpFiles.length === 0) {
66
+ console.log(red(`No test results directories found matching pattern: ${resultsDir}`));
67
+ return;
68
+ }
69
+ try {
70
+ const allureReport = new AllureReport(config);
71
+ await allureReport.restoreState(Array.from(stageDumpFiles));
72
+ await allureReport.start();
73
+ for (const dir of resultsDirectories) {
74
+ await allureReport.readDirectory(dir);
75
+ }
76
+ await allureReport.done();
77
+ }
78
+ catch (error) {
79
+ if (error instanceof KnownError) {
80
+ console.error(red(error.message));
81
+ exit(1);
82
+ return;
83
+ }
84
+ await logError("Failed to generate report due to unexpected error", error);
85
+ exit(1);
86
+ }
87
+ }
88
+ }
89
+ GenerateCommand.paths = [["generate"]];
90
+ GenerateCommand.usage = Command.Usage({
13
91
  description: "Generates the report to specified directory",
14
- options: [
92
+ details: "This command generates a report from the provided Allure Results directory.",
93
+ examples: [
94
+ ["generate ./allure-results", "Generate a report from the ./allure-results directory"],
15
95
  [
16
- "--config, -c <file>",
17
- {
18
- description: "The path Allure config file",
19
- },
96
+ "generate ./allure-results --output custom-report",
97
+ "Generate a report from the ./allure-results directory to the custom-report directory",
20
98
  ],
21
99
  [
22
- "--output, -o <file>",
23
- {
24
- description: "The output directory name. Absolute paths are accepted as well (default: allure-report)",
25
- },
100
+ "generate --stage=windows.zip --stage=macos.zip ./allure-results",
101
+ "Generate a report using data from windows.zip and macos.zip archives and using results from the ./allure-results directory",
26
102
  ],
27
103
  [
28
- "--cwd <cwd>",
29
- {
30
- description: "The working directory for the command to run (default: current working directory)",
31
- },
104
+ "generate --stage=allure-*.zip",
105
+ "Generate a report using data from any stage archive that matches the given pattern only (ignoring results directories)",
32
106
  ],
33
107
  ],
34
- action: GenerateCommandAction,
35
108
  });
@@ -1,7 +1,9 @@
1
- type CommandOptions = {
2
- historyPath?: string;
3
- reportName?: string;
4
- };
5
- export declare const HistoryCommandAction: (resultsDir: string, options: CommandOptions) => Promise<void>;
6
- export declare const HistoryCommand: (cli: import("cac").CAC) => void;
7
- export {};
1
+ import { Command } from "clipanion";
2
+ export declare class HistoryCommand extends Command {
3
+ static paths: string[][];
4
+ static usage: import("clipanion").Usage;
5
+ resultsDir: string;
6
+ historyPath: string | undefined;
7
+ reportName: string | undefined;
8
+ execute(): Promise<void>;
9
+ }
@@ -1,34 +1,37 @@
1
- import { AllureReport, resolveConfig } from "@allure/core";
2
- import { createCommand } from "../utils/commands.js";
3
- export const HistoryCommandAction = async (resultsDir, options) => {
4
- const config = await resolveConfig({
5
- historyPath: options.historyPath,
6
- name: options.reportName,
7
- plugins: {},
8
- });
9
- const allureReport = new AllureReport(config);
10
- await allureReport.start();
11
- await allureReport.readDirectory(resultsDir);
12
- await allureReport.done();
13
- };
14
- export const HistoryCommand = createCommand({
15
- name: "history <resultsDir>",
1
+ import { AllureReport, resolveConfig } from "@allurereport/core";
2
+ import { Command, Option } from "clipanion";
3
+ export class HistoryCommand extends Command {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.resultsDir = Option.String({ required: true, name: "The directory with Allure results" });
7
+ this.historyPath = Option.String("--history-path,-h", {
8
+ description: "The path to history file",
9
+ });
10
+ this.reportName = Option.String("--report-name,--name", {
11
+ description: "The report name",
12
+ });
13
+ }
14
+ async execute() {
15
+ const config = await resolveConfig({
16
+ historyPath: this.historyPath ?? "history.jsonl",
17
+ name: this.reportName ?? "Allure Report",
18
+ plugins: {},
19
+ });
20
+ const allureReport = new AllureReport(config);
21
+ await allureReport.start();
22
+ await allureReport.readDirectory(this.resultsDir);
23
+ await allureReport.done();
24
+ }
25
+ }
26
+ HistoryCommand.paths = [["history"]];
27
+ HistoryCommand.usage = Command.Usage({
16
28
  description: "Generates the history to specified folder",
17
- options: [
29
+ details: "This command generates history from the provided Allure Results directory.",
30
+ examples: [
31
+ ["history ./allure-results", "Generate history from the ./allure-results directory"],
18
32
  [
19
- "--history-path, -h <file>",
20
- {
21
- description: "The path to history file",
22
- default: "history.jsonl",
23
- },
24
- ],
25
- [
26
- "--report-name, --name <string>",
27
- {
28
- description: "The report name",
29
- default: "Allure Report",
30
- },
33
+ "history ./allure-results --history-path custom-history.jsonl",
34
+ "Generate history from the ./allure-results directory to the custom-history.jsonl file",
31
35
  ],
32
36
  ],
33
- action: HistoryCommandAction,
34
37
  });
@@ -1,6 +1,7 @@
1
1
  export * from "./history.js";
2
2
  export * from "./testplan.js";
3
3
  export * from "./classic.js";
4
+ export * from "./allure2.js";
4
5
  export * from "./awesome.js";
5
6
  export * from "./csv.js";
6
7
  export * from "./history.js";
@@ -13,3 +14,9 @@ export * from "./open.js";
13
14
  export * from "./qualityGate.js";
14
15
  export * from "./log.js";
15
16
  export * from "./generate.js";
17
+ export * from "./dashboard.js";
18
+ export * from "./login.js";
19
+ export * from "./logout.js";
20
+ export * from "./whoami.js";
21
+ export * from "./projects/index.js";
22
+ export * from "./results/index.js";
@@ -1,6 +1,7 @@
1
1
  export * from "./history.js";
2
2
  export * from "./testplan.js";
3
3
  export * from "./classic.js";
4
+ export * from "./allure2.js";
4
5
  export * from "./awesome.js";
5
6
  export * from "./csv.js";
6
7
  export * from "./history.js";
@@ -13,3 +14,9 @@ export * from "./open.js";
13
14
  export * from "./qualityGate.js";
14
15
  export * from "./log.js";
15
16
  export * from "./generate.js";
17
+ export * from "./dashboard.js";
18
+ export * from "./login.js";
19
+ export * from "./logout.js";
20
+ export * from "./whoami.js";
21
+ export * from "./projects/index.js";
22
+ export * from "./results/index.js";
@@ -1,6 +1,8 @@
1
- type CommandOptions = {
2
- output?: string;
3
- };
4
- export declare const KnownIssueCommandAction: (resultsDir: string, options: CommandOptions) => Promise<void>;
5
- export declare const KnownIssueCommand: (cli: import("cac").CAC) => void;
6
- export {};
1
+ import { Command } from "clipanion";
2
+ export declare class KnownIssueCommand extends Command {
3
+ static paths: string[][];
4
+ static usage: import("clipanion").Usage;
5
+ resultsDir: string;
6
+ output: string | undefined;
7
+ execute(): Promise<void>;
8
+ }
@@ -1,27 +1,38 @@
1
- import { AllureReport, createConfig, writeKnownIssues } from "@allure/core";
1
+ import { AllureReport, resolveConfig, writeKnownIssues } from "@allurereport/core";
2
+ import { Command, Option } from "clipanion";
2
3
  import console from "node:console";
3
4
  import { resolve } from "node:path";
4
- import { createCommand } from "../utils/commands.js";
5
- export const KnownIssueCommandAction = async (resultsDir, options) => {
6
- const { output = "known-issues.json" } = options;
7
- const config = await createConfig({});
8
- const allureReport = new AllureReport(config);
9
- const targetPath = resolve(output);
10
- await allureReport.readDirectory(resultsDir);
11
- await writeKnownIssues(allureReport.store, output);
12
- console.log(`writing known-issues.json to ${targetPath}`);
13
- };
14
- export const KnownIssueCommand = createCommand({
15
- name: "known-issue <resultsDir>",
5
+ export class KnownIssueCommand extends Command {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.resultsDir = Option.String({ required: true, name: "The directory with Allure results" });
9
+ this.output = Option.String("--output,-o", {
10
+ description: "The output file name. Absolute paths are accepted as well",
11
+ });
12
+ }
13
+ async execute() {
14
+ const outputPath = this.output ?? "known-issues.json";
15
+ const config = await resolveConfig({
16
+ plugins: {},
17
+ });
18
+ const allureReport = new AllureReport(config);
19
+ await allureReport.start();
20
+ await allureReport.readDirectory(this.resultsDir);
21
+ await allureReport.done();
22
+ const targetPath = resolve(outputPath);
23
+ await writeKnownIssues(allureReport.store, outputPath);
24
+ console.log(`writing known-issues.json to ${targetPath}`);
25
+ }
26
+ }
27
+ KnownIssueCommand.paths = [["known-issue"]];
28
+ KnownIssueCommand.usage = Command.Usage({
16
29
  description: "Generates a known issue list",
17
- options: [
30
+ details: "This command generates a known issue list from the provided Allure Results directory.",
31
+ examples: [
32
+ ["known-issue ./allure-results", "Generate a known issue list from the ./allure-results directory"],
18
33
  [
19
- "--output, -o <file>",
20
- {
21
- description: "The output file name. Absolute paths are accepted as well",
22
- default: "known-issues.json",
23
- },
34
+ "known-issue ./allure-results --output custom-issues.json",
35
+ "Generate a known issue list from the ./allure-results directory to the custom-issues.json file",
24
36
  ],
25
37
  ],
26
- action: KnownIssueCommandAction,
27
38
  });
@@ -1,7 +1,12 @@
1
- export type LogCommandOptions = {
2
- allSteps?: boolean;
3
- withTrace?: boolean;
4
- groupBy?: "suites" | "features" | "packages" | "none";
5
- };
6
- export declare const LogCommandAction: (resultsDir: string, options: LogCommandOptions) => Promise<void>;
7
- export declare const LogCommand: (cli: import("cac").CAC) => void;
1
+ import { Command } from "clipanion";
2
+ export declare class LogCommand extends Command {
3
+ static paths: string[][];
4
+ static usage: import("clipanion").Usage;
5
+ resultsDir: string;
6
+ config: string | undefined;
7
+ cwd: string | undefined;
8
+ groupBy: string | undefined;
9
+ allSteps: boolean | undefined;
10
+ withTrace: boolean | undefined;
11
+ execute(): Promise<void>;
12
+ }