allure 3.0.0-beta.15 → 3.0.0-beta.17

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 (54) hide show
  1. package/dist/commands/allure2.d.ts +15 -11
  2. package/dist/commands/allure2.js +70 -63
  3. package/dist/commands/awesome.d.ts +18 -13
  4. package/dist/commands/awesome.js +82 -85
  5. package/dist/commands/classic.d.ts +15 -11
  6. package/dist/commands/classic.js +70 -63
  7. package/dist/commands/csv.d.ts +13 -9
  8. package/dist/commands/csv.js +62 -45
  9. package/dist/commands/dashboard.d.ts +15 -11
  10. package/dist/commands/dashboard.js +70 -61
  11. package/dist/commands/generate.d.ts +11 -9
  12. package/dist/commands/generate.js +51 -29
  13. package/dist/commands/history.d.ts +9 -7
  14. package/dist/commands/history.js +31 -28
  15. package/dist/commands/index.d.ts +4 -0
  16. package/dist/commands/index.js +4 -0
  17. package/dist/commands/knownIssue.d.ts +8 -6
  18. package/dist/commands/knownIssue.js +30 -23
  19. package/dist/commands/log.d.ts +12 -7
  20. package/dist/commands/log.js +57 -40
  21. package/dist/commands/login.d.ts +8 -0
  22. package/dist/commands/login.js +50 -0
  23. package/dist/commands/logout.d.ts +8 -0
  24. package/dist/commands/logout.js +50 -0
  25. package/dist/commands/open.d.ts +11 -9
  26. package/dist/commands/open.js +34 -40
  27. package/dist/commands/projects/create.d.ts +9 -0
  28. package/dist/commands/projects/create.js +83 -0
  29. package/dist/commands/projects/delete.d.ts +10 -0
  30. package/dist/commands/projects/delete.js +68 -0
  31. package/dist/commands/projects/index.d.ts +3 -0
  32. package/dist/commands/projects/index.js +3 -0
  33. package/dist/commands/projects/list.d.ts +8 -0
  34. package/dist/commands/projects/list.js +75 -0
  35. package/dist/commands/qualityGate.d.ts +9 -7
  36. package/dist/commands/qualityGate.js +46 -42
  37. package/dist/commands/run.d.ts +13 -10
  38. package/dist/commands/run.js +109 -104
  39. package/dist/commands/slack.d.ts +9 -5
  40. package/dist/commands/slack.js +54 -31
  41. package/dist/commands/testplan.d.ts +8 -6
  42. package/dist/commands/testplan.js +36 -29
  43. package/dist/commands/watch.d.ts +12 -10
  44. package/dist/commands/watch.js +103 -99
  45. package/dist/commands/whoami.d.ts +8 -0
  46. package/dist/commands/whoami.js +57 -0
  47. package/dist/index.js +31 -28
  48. package/dist/utils/index.d.ts +1 -0
  49. package/dist/utils/index.js +1 -0
  50. package/dist/utils/logs.d.ts +3 -0
  51. package/dist/utils/logs.js +32 -0
  52. package/package.json +24 -19
  53. package/dist/utils/commands.d.ts +0 -16
  54. package/dist/utils/commands.js +0 -16
@@ -1,11 +1,15 @@
1
- type ClassicCommandOptions = {
2
- output?: string;
3
- reportName?: string;
4
- reportLanguage?: string;
5
- singleFile?: boolean;
6
- historyPath?: string;
7
- knownIssues?: string;
8
- };
9
- export declare const ClassicLegacyCommandAction: (resultsDir: string, options: ClassicCommandOptions) => Promise<void>;
10
- export declare const ClassicLegacyCommand: (cli: import("cac").CAC) => void;
11
- export {};
1
+ import { Command } from "clipanion";
2
+ export declare class Allure2Command 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
+ reportLanguage: string | undefined;
11
+ singleFile: boolean | undefined;
12
+ historyPath: string | undefined;
13
+ knownIssues: string | undefined;
14
+ execute(): Promise<void>;
15
+ }
@@ -1,70 +1,77 @@
1
- import { AllureReport, resolveConfig } from "@allurereport/core";
1
+ import { AllureReport, readConfig } from "@allurereport/core";
2
+ import Allure2Plugin from "@allurereport/plugin-allure2";
3
+ import { Command, Option } from "clipanion";
2
4
  import * as console from "node:console";
3
- import { createCommand } from "../utils/commands.js";
4
- export const ClassicLegacyCommandAction = async (resultsDir, options) => {
5
- const before = new Date().getTime();
6
- const { output, reportName: name, historyPath, knownIssues: knownIssuesPath, ...rest } = options;
7
- const config = await resolveConfig({
8
- output,
9
- name,
10
- historyPath,
11
- knownIssuesPath,
12
- plugins: {
13
- "@allurereport/plugin-allure2": {
14
- options: rest,
15
- },
16
- },
17
- });
18
- const allureReport = new AllureReport(config);
19
- await allureReport.start();
20
- await allureReport.readDirectory(resultsDir);
21
- await allureReport.done();
22
- const after = new Date().getTime();
23
- console.log(`the report successfully generated (${after - before}ms)`);
24
- };
25
- export const ClassicLegacyCommand = createCommand({
26
- name: "allure2 <resultsDir>",
27
- description: "Generates Allure Classic report based on provided Allure Results",
28
- options: [
29
- [
30
- "--output, -o <file>",
31
- {
32
- description: "The output directory name. Absolute paths are accepted as well",
33
- default: "allure-report",
34
- },
35
- ],
36
- [
37
- "--report-name, --name <string>",
38
- {
39
- description: "The report name",
40
- default: "Allure Report",
41
- },
42
- ],
43
- [
44
- "--report-language, --lang <string>",
5
+ import { realpath } from "node:fs/promises";
6
+ import process from "node:process";
7
+ export class Allure2Command 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.reportLanguage = Option.String("--report-language,--lang", {
24
+ description: "Default language of the report (default: OS language)",
25
+ });
26
+ this.singleFile = Option.Boolean("--single-file", {
27
+ description: "Generate single file report",
28
+ });
29
+ this.historyPath = Option.String("--history-path,-h", {
30
+ description: "The path to history file",
31
+ });
32
+ this.knownIssues = Option.String("--known-issues", {
33
+ description: "Path to the known issues file. Updates the file and quarantines failed tests when specified",
34
+ });
35
+ }
36
+ async execute() {
37
+ const cwd = await realpath(this.cwd ?? process.cwd());
38
+ const before = new Date().getTime();
39
+ const defaultAllure2Options = {
40
+ singleFile: this.singleFile ?? false,
41
+ reportLanguage: this.reportLanguage,
42
+ };
43
+ const config = await readConfig(cwd, this.config, {
44
+ output: this.output ?? "allure-report",
45
+ name: this.reportName ?? "Allure Report",
46
+ knownIssuesPath: this.knownIssues,
47
+ historyPath: this.historyPath,
48
+ });
49
+ config.plugins = [
45
50
  {
46
- description: "Default language of the report (default: OS language)",
51
+ id: "allure2",
52
+ enabled: true,
53
+ options: defaultAllure2Options,
54
+ plugin: new Allure2Plugin(defaultAllure2Options),
47
55
  },
48
- ],
49
- [
50
- "--single-file",
51
- {
52
- description: "Generate single file report",
53
- default: false,
54
- },
55
- ],
56
- [
57
- "--history-path, -h <file>",
58
- {
59
- description: "The path to history file",
60
- },
61
- ],
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
+ Allure2Command.paths = [["allure2"]];
66
+ Allure2Command.usage = Command.Usage({
67
+ category: "Reports",
68
+ description: "Generates Allure Classic report based on provided Allure Results",
69
+ details: "This command generates an Allure Classic report from the provided Allure Results directory.",
70
+ examples: [
71
+ ["allure2 ./allure-results", "Generate a report from the ./allure-results directory"],
62
72
  [
63
- "--known-issues <file>",
64
- {
65
- description: "Path to the known issues file. Updates the file and quarantines failed tests when specified",
66
- },
73
+ "allure2 ./allure-results --output custom-report",
74
+ "Generate a report from the ./allure-results directory to the custom-report directory",
67
75
  ],
68
76
  ],
69
- action: ClassicLegacyCommandAction,
70
77
  });
@@ -1,13 +1,18 @@
1
- type AwesomeCommandOptions = {
2
- output?: string;
3
- reportName?: string;
4
- reportLanguage?: string;
5
- logo?: string;
6
- singleFile?: boolean;
7
- historyPath?: string;
8
- knownIssues?: string;
9
- groupBy?: string;
10
- };
11
- export declare const AwesomeCommandAction: (resultsDir: string, options: AwesomeCommandOptions) => Promise<void>;
12
- export declare const AwesomeCommand: (cli: import("cac").CAC) => void;
13
- export {};
1
+ import { Command } from "clipanion";
2
+ export declare class AwesomeCommand 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
+ historyPath: string | undefined;
15
+ knownIssues: string | undefined;
16
+ groupBy: string | undefined;
17
+ execute(): Promise<void>;
18
+ }
@@ -1,92 +1,89 @@
1
- import { AllureReport, resolveConfig } from "@allurereport/core";
1
+ import { AllureReport, readConfig } from "@allurereport/core";
2
+ import { default as AwesomePlugin } from "@allurereport/plugin-awesome";
3
+ import { Command, Option } from "clipanion";
2
4
  import * as console from "node:console";
3
- import { createCommand } from "../utils/commands.js";
4
- export const AwesomeCommandAction = async (resultsDir, options) => {
5
- const before = new Date().getTime();
6
- const { output, reportName: name, historyPath, knownIssues: knownIssuesPath, groupBy, ...rest } = options;
7
- const config = await resolveConfig({
8
- output,
9
- name,
10
- historyPath,
11
- knownIssuesPath,
12
- plugins: {
13
- "@allurereport/plugin-awesome": {
14
- options: {
15
- ...rest,
16
- groupBy: groupBy?.split(","),
17
- },
18
- },
19
- },
20
- });
21
- const allureReport = new AllureReport(config);
22
- await allureReport.start();
23
- await allureReport.readDirectory(resultsDir);
24
- await allureReport.done();
25
- const after = new Date().getTime();
26
- console.log(`the report successfully generated (${after - before}ms)`);
27
- };
28
- export const AwesomeCommand = createCommand({
29
- name: "awesome <resultsDir>",
30
- description: "Generates Allure Awesome report based on provided Allure Results",
31
- options: [
32
- [
33
- "--output, -o <file>",
34
- {
35
- description: "The output directory name. Absolute paths are accepted as well",
36
- default: "allure-report",
37
- },
38
- ],
39
- [
40
- "--report-name, --name <string>",
41
- {
42
- description: "The report name",
43
- default: "Allure Report",
44
- },
45
- ],
46
- [
47
- "--single-file",
5
+ import { realpath } from "node:fs/promises";
6
+ import process from "node:process";
7
+ export class AwesomeCommand 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
+ this.historyPath = Option.String("--history-path,-h", {
36
+ description: "The path to history file",
37
+ });
38
+ this.knownIssues = Option.String("--known-issues", {
39
+ description: "Path to the known issues file. Updates the file and quarantines failed tests when specified",
40
+ });
41
+ this.groupBy = Option.String("--group-by,-g", {
42
+ description: "Group test results by labels. The labels should be separated by commas",
43
+ });
44
+ }
45
+ async execute() {
46
+ const cwd = await realpath(this.cwd ?? process.cwd());
47
+ const before = new Date().getTime();
48
+ const defaultAwesomeOptions = {
49
+ singleFile: this.singleFile ?? false,
50
+ logo: this.logo,
51
+ theme: this.theme,
52
+ reportLanguage: this.reportLanguage,
53
+ groupBy: this.groupBy?.split?.(",") ?? ["parentSuite", "suite", "subSuite"],
54
+ };
55
+ const config = await readConfig(cwd, this.config, {
56
+ output: this.output ?? "allure-report",
57
+ name: this.reportName ?? "Allure Report",
58
+ knownIssuesPath: this.knownIssues,
59
+ historyPath: this.historyPath,
60
+ });
61
+ config.plugins = [
48
62
  {
49
- description: "Generate single file report",
50
- default: false,
63
+ id: "awesome",
64
+ enabled: true,
65
+ options: defaultAwesomeOptions,
66
+ plugin: new AwesomePlugin(defaultAwesomeOptions),
51
67
  },
52
- ],
53
- [
54
- "--logo <string>",
55
- {
56
- description: "Path to the report logo which will be displayed in the header",
57
- },
58
- ],
59
- [
60
- "--theme <string>",
61
- {
62
- description: "Default theme of the report (default: OS theme)",
63
- },
64
- ],
65
- [
66
- "--report-language, --lang <string>",
67
- {
68
- description: "Default language of the report (default: OS language)",
69
- },
70
- ],
71
- [
72
- "--history-path, -h <file>",
73
- {
74
- description: "The path to history file",
75
- },
76
- ],
77
- [
78
- "--known-issues <file>",
79
- {
80
- description: "Path to the known issues file. Updates the file and quarantines failed tests when specified",
81
- },
82
- ],
68
+ ];
69
+ const allureReport = new AllureReport(config);
70
+ await allureReport.start();
71
+ await allureReport.readDirectory(this.resultsDir);
72
+ await allureReport.done();
73
+ const after = new Date().getTime();
74
+ console.log(`the report successfully generated (${after - before}ms)`);
75
+ }
76
+ }
77
+ AwesomeCommand.paths = [["awesome"]];
78
+ AwesomeCommand.usage = Command.Usage({
79
+ category: "Reports",
80
+ description: "Generates Allure Awesome report based on provided Allure Results",
81
+ details: "This command generates an Allure Awesome report from the provided Allure Results directory.",
82
+ examples: [
83
+ ["awesome ./allure-results", "Generate a report from the ./allure-results directory"],
83
84
  [
84
- "--group-by, -g <string>",
85
- {
86
- description: "Group test results by labels. The labels should be separated by commas",
87
- default: "parentSuite,suite,subSuite",
88
- },
85
+ "awesome ./allure-results --output custom-report",
86
+ "Generate a report from the ./allure-results directory to the custom-report directory",
89
87
  ],
90
88
  ],
91
- action: AwesomeCommandAction,
92
89
  });
@@ -1,11 +1,15 @@
1
- type ClassicCommandOptions = {
2
- output?: string;
3
- reportName?: string;
4
- reportLanguage?: string;
5
- singleFile?: boolean;
6
- historyPath?: string;
7
- knownIssues?: string;
8
- };
9
- export declare const ClassicCommandAction: (resultsDir: string, options: ClassicCommandOptions) => Promise<void>;
10
- export declare const ClassicCommand: (cli: import("cac").CAC) => void;
11
- export {};
1
+ import { Command } from "clipanion";
2
+ export declare class ClassicCommand 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
+ reportLanguage: string | undefined;
11
+ singleFile: boolean | undefined;
12
+ historyPath: string | undefined;
13
+ knownIssues: string | undefined;
14
+ execute(): Promise<void>;
15
+ }
@@ -1,70 +1,77 @@
1
- import { AllureReport, resolveConfig } from "@allurereport/core";
1
+ import { AllureReport, readConfig } from "@allurereport/core";
2
+ import ClassicPlugin from "@allurereport/plugin-classic";
3
+ import { Command, Option } from "clipanion";
2
4
  import * as console from "node:console";
3
- import { createCommand } from "../utils/commands.js";
4
- export const ClassicCommandAction = async (resultsDir, options) => {
5
- const before = new Date().getTime();
6
- const { output, reportName: name, historyPath, knownIssues: knownIssuesPath, ...rest } = options;
7
- const config = await resolveConfig({
8
- output,
9
- name,
10
- historyPath,
11
- knownIssuesPath,
12
- plugins: {
13
- "@allurereport/plugin-classic": {
14
- options: rest,
15
- },
16
- },
17
- });
18
- const allureReport = new AllureReport(config);
19
- await allureReport.start();
20
- await allureReport.readDirectory(resultsDir);
21
- await allureReport.done();
22
- const after = new Date().getTime();
23
- console.log(`the report successfully generated (${after - before}ms)`);
24
- };
25
- export const ClassicCommand = createCommand({
26
- name: "classic <resultsDir>",
27
- description: "Generates Allure Classic report based on provided Allure Results",
28
- options: [
29
- [
30
- "--output, -o <file>",
31
- {
32
- description: "The output directory name. Absolute paths are accepted as well",
33
- default: "allure-report",
34
- },
35
- ],
36
- [
37
- "--report-name, --name <string>",
38
- {
39
- description: "The report name",
40
- default: "Allure Report",
41
- },
42
- ],
43
- [
44
- "--report-language, --lang <string>",
5
+ import { realpath } from "node:fs/promises";
6
+ import process from "node:process";
7
+ export class ClassicCommand 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.reportLanguage = Option.String("--report-language,--lang", {
24
+ description: "Default language of the report (default: OS language)",
25
+ });
26
+ this.singleFile = Option.Boolean("--single-file", {
27
+ description: "Generate single file report",
28
+ });
29
+ this.historyPath = Option.String("--history-path,-h", {
30
+ description: "The path to history file",
31
+ });
32
+ this.knownIssues = Option.String("--known-issues", {
33
+ description: "Path to the known issues file. Updates the file and quarantines failed tests when specified",
34
+ });
35
+ }
36
+ async execute() {
37
+ const cwd = await realpath(this.cwd ?? process.cwd());
38
+ const before = new Date().getTime();
39
+ const defaultClassicOptions = {
40
+ singleFile: this.singleFile ?? false,
41
+ reportLanguage: this.reportLanguage,
42
+ };
43
+ const config = await readConfig(cwd, this.config, {
44
+ output: this.output ?? "allure-report",
45
+ name: this.reportName ?? "Allure Report",
46
+ knownIssuesPath: this.knownIssues,
47
+ historyPath: this.historyPath,
48
+ });
49
+ config.plugins = [
45
50
  {
46
- description: "Default language of the report (default: OS language)",
51
+ id: "classic",
52
+ enabled: true,
53
+ options: defaultClassicOptions,
54
+ plugin: new ClassicPlugin(defaultClassicOptions),
47
55
  },
48
- ],
49
- [
50
- "--single-file",
51
- {
52
- description: "Generate single file report",
53
- default: false,
54
- },
55
- ],
56
- [
57
- "--history-path, -h <file>",
58
- {
59
- description: "The path to history file",
60
- },
61
- ],
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
+ ClassicCommand.paths = [["classic"]];
66
+ ClassicCommand.usage = Command.Usage({
67
+ category: "Reports",
68
+ description: "Generates Allure Classic report based on provided Allure Results",
69
+ details: "This command generates an Allure Classic report from the provided Allure Results directory.",
70
+ examples: [
71
+ ["classic ./allure-results", "Generate a report from the ./allure-results directory"],
62
72
  [
63
- "--known-issues <file>",
64
- {
65
- description: "Path to the known issues file. Updates the file and quarantines failed tests when specified",
66
- },
73
+ "classic ./allure-results --output custom-report",
74
+ "Generate a report from the ./allure-results directory to the custom-report directory",
67
75
  ],
68
76
  ],
69
- action: ClassicCommandAction,
70
77
  });
@@ -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
+ }