allure 3.0.0-beta.2 → 3.0.0-beta.21

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 (70) 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 +98 -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 +8 -0
  17. package/dist/commands/index.js +8 -0
  18. package/dist/commands/jira/clear.d.ts +16 -0
  19. package/dist/commands/jira/clear.js +113 -0
  20. package/dist/commands/jira/index.d.ts +1 -0
  21. package/dist/commands/jira/index.js +1 -0
  22. package/dist/commands/knownIssue.d.ts +8 -6
  23. package/dist/commands/knownIssue.js +31 -20
  24. package/dist/commands/log.d.ts +12 -7
  25. package/dist/commands/log.js +58 -40
  26. package/dist/commands/login.d.ts +8 -0
  27. package/dist/commands/login.js +50 -0
  28. package/dist/commands/logout.d.ts +8 -0
  29. package/dist/commands/logout.js +50 -0
  30. package/dist/commands/open.d.ts +11 -8
  31. package/dist/commands/open.js +36 -36
  32. package/dist/commands/projects/create.d.ts +9 -0
  33. package/dist/commands/projects/create.js +83 -0
  34. package/dist/commands/projects/delete.d.ts +10 -0
  35. package/dist/commands/projects/delete.js +68 -0
  36. package/dist/commands/projects/index.d.ts +3 -0
  37. package/dist/commands/projects/index.js +3 -0
  38. package/dist/commands/projects/list.d.ts +8 -0
  39. package/dist/commands/projects/list.js +75 -0
  40. package/dist/commands/qualityGate.d.ts +14 -6
  41. package/dist/commands/qualityGate.js +125 -39
  42. package/dist/commands/results/index.d.ts +2 -0
  43. package/dist/commands/results/index.js +2 -0
  44. package/dist/commands/results/pack.d.ts +10 -0
  45. package/dist/commands/results/pack.js +106 -0
  46. package/dist/commands/results/unpack.d.ts +9 -0
  47. package/dist/commands/results/unpack.js +79 -0
  48. package/dist/commands/run.d.ts +24 -10
  49. package/dist/commands/run.js +279 -109
  50. package/dist/commands/slack.d.ts +9 -5
  51. package/dist/commands/slack.js +55 -31
  52. package/dist/commands/testplan.d.ts +8 -6
  53. package/dist/commands/testplan.js +38 -30
  54. package/dist/commands/watch.d.ts +12 -10
  55. package/dist/commands/watch.js +110 -106
  56. package/dist/commands/whoami.d.ts +8 -0
  57. package/dist/commands/whoami.js +57 -0
  58. package/dist/index.d.ts +2 -2
  59. package/dist/index.js +36 -28
  60. package/dist/utils/index.d.ts +1 -0
  61. package/dist/utils/index.js +1 -0
  62. package/dist/utils/logs.d.ts +3 -0
  63. package/dist/utils/logs.js +32 -0
  64. package/dist/utils/process.d.ts +8 -2
  65. package/dist/utils/process.js +17 -6
  66. package/dist/utils/terminal.d.ts +1 -1
  67. package/dist/utils/terminal.js +1 -1
  68. package/package.json +35 -15
  69. package/dist/utils/commands.d.ts +0 -16
  70. package/dist/utils/commands.js +0 -14
@@ -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
+ }
@@ -1,46 +1,64 @@
1
- import { AllureReport, resolveConfig } from "@allure/core";
2
- import { createCommand } from "../utils/commands.js";
3
- export const LogCommandAction = async (resultsDir, options) => {
4
- const before = new Date().getTime();
5
- const config = await resolveConfig({
6
- plugins: {
7
- "@allure/plugin-log": {
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 LogCommand = createCommand({
20
- name: "log <resultsDir>",
21
- description: "Prints Allure Results to the console",
22
- options: [
23
- [
24
- "--group-by <label>",
1
+ import { AllureReport, readConfig } from "@allurereport/core";
2
+ import LogPlugin from "@allurereport/plugin-log";
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 LogCommand 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.groupBy = Option.String("--group-by", {
18
+ description: "Group tests by type (none, suite, feature, package, etc.)",
19
+ });
20
+ this.allSteps = Option.Boolean("--all-steps", {
21
+ description: "Show all steps. By default only failed steps are shown",
22
+ });
23
+ this.withTrace = Option.Boolean("--with-trace", {
24
+ description: "Print stack trace for failed tests",
25
+ });
26
+ }
27
+ async execute() {
28
+ const cwd = await realpath(this.cwd ?? process.cwd());
29
+ const before = new Date().getTime();
30
+ const defaultLogOptions = {
31
+ allSteps: this.allSteps ?? false,
32
+ withTrace: this.withTrace ?? false,
33
+ groupBy: this.groupBy ?? "suite",
34
+ };
35
+ const config = await readConfig(cwd, this.config);
36
+ config.plugins = [
25
37
  {
26
- description: "Group tests by type (none, suite, feature, package, etc.)",
27
- default: "suite",
38
+ id: "log",
39
+ enabled: true,
40
+ options: defaultLogOptions,
41
+ plugin: new LogPlugin(defaultLogOptions),
28
42
  },
29
- ],
30
- [
31
- "--all-steps",
32
- {
33
- description: "Show all steps. By default only failed steps are shown",
34
- default: false,
35
- },
36
- ],
43
+ ];
44
+ const allureReport = new AllureReport(config);
45
+ await allureReport.start();
46
+ await allureReport.readDirectory(this.resultsDir);
47
+ await allureReport.done();
48
+ const after = new Date().getTime();
49
+ console.log(`the report successfully generated (${after - before}ms)`);
50
+ }
51
+ }
52
+ LogCommand.paths = [["log"]];
53
+ LogCommand.usage = Command.Usage({
54
+ category: "Reports",
55
+ description: "Prints Allure Results to the console",
56
+ details: "This command prints Allure Results to the console from the provided Allure Results directory.",
57
+ examples: [
58
+ ["log ./allure-results", "Print results from the ./allure-results directory"],
37
59
  [
38
- "--with-trace",
39
- {
40
- description: "Print stack trace for failed tests",
41
- default: false,
42
- },
60
+ "log ./allure-results --all-steps --with-trace",
61
+ "Print results with all steps and stack traces from the ./allure-results directory",
43
62
  ],
44
63
  ],
45
- action: LogCommandAction,
46
64
  });
@@ -0,0 +1,8 @@
1
+ import { Command } from "clipanion";
2
+ export declare class LoginCommand extends Command {
3
+ static paths: string[][];
4
+ static usage: import("clipanion").Usage;
5
+ config: string | undefined;
6
+ cwd: string | undefined;
7
+ execute(): Promise<void>;
8
+ }
@@ -0,0 +1,50 @@
1
+ import { readConfig } from "@allurereport/core";
2
+ import { AllureServiceClient, KnownError } from "@allurereport/service";
3
+ import { Command, Option } from "clipanion";
4
+ import * as console from "node:console";
5
+ import { exit } from "node:process";
6
+ import { green, red } from "yoctocolors";
7
+ import { logError } from "../utils/logs.js";
8
+ export class LoginCommand extends Command {
9
+ constructor() {
10
+ super(...arguments);
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
+ }
18
+ async execute() {
19
+ const config = await readConfig(this.cwd, this.config);
20
+ if (!config?.allureService?.url) {
21
+ console.error(red("No Allure Service URL is provided. Please provide it in the `allureService.url` field in the `allure.config.js` file"));
22
+ exit(1);
23
+ return;
24
+ }
25
+ const serviceClient = new AllureServiceClient(config.allureService);
26
+ try {
27
+ await serviceClient.login();
28
+ console.info(green("Logged in"));
29
+ }
30
+ catch (error) {
31
+ if (error instanceof KnownError) {
32
+ console.error(red(error.message));
33
+ exit(1);
34
+ return;
35
+ }
36
+ await logError("Failed to login due to unexpected error", error);
37
+ exit(1);
38
+ }
39
+ }
40
+ }
41
+ LoginCommand.paths = [["login"]];
42
+ LoginCommand.usage = Command.Usage({
43
+ category: "Allure Service",
44
+ description: "Logs in to the Allure Service",
45
+ details: "This command logs in to the Allure Service using the configuration from the Allure config file.",
46
+ examples: [
47
+ ["login", "Log in to the Allure Service using the default configuration"],
48
+ ["login --config custom-config.js", "Log in to the Allure Service using a custom configuration file"],
49
+ ],
50
+ });
@@ -0,0 +1,8 @@
1
+ import { Command } from "clipanion";
2
+ export declare class LogoutCommand extends Command {
3
+ static paths: string[][];
4
+ static usage: import("clipanion").Usage;
5
+ config: string | undefined;
6
+ cwd: string | undefined;
7
+ execute(): Promise<void>;
8
+ }
@@ -0,0 +1,50 @@
1
+ import { readConfig } from "@allurereport/core";
2
+ import { AllureServiceClient, KnownError } from "@allurereport/service";
3
+ import { Command, Option } from "clipanion";
4
+ import * as console from "node:console";
5
+ import { exit } from "node:process";
6
+ import { green, red } from "yoctocolors";
7
+ import { logError } from "../utils/logs.js";
8
+ export class LogoutCommand extends Command {
9
+ constructor() {
10
+ super(...arguments);
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
+ }
18
+ async execute() {
19
+ const config = await readConfig(this.cwd, this.config);
20
+ if (!config?.allureService?.url) {
21
+ console.error(red("No Allure Service URL is provided. Please provide it in the `allureService.url` field in the `allure.config.js` file"));
22
+ exit(1);
23
+ return;
24
+ }
25
+ const serviceClient = new AllureServiceClient(config.allureService);
26
+ try {
27
+ await serviceClient.logout();
28
+ console.info(green("Logged out"));
29
+ }
30
+ catch (error) {
31
+ if (error instanceof KnownError) {
32
+ console.error(red(error.message));
33
+ exit(1);
34
+ return;
35
+ }
36
+ await logError("Failed to logout due to unexpected error", error);
37
+ exit(1);
38
+ }
39
+ }
40
+ }
41
+ LogoutCommand.paths = [["logout"]];
42
+ LogoutCommand.usage = Command.Usage({
43
+ category: "Allure Service",
44
+ description: "Logs out from the Allure Service",
45
+ details: "This command logs out from the Allure Service using the configuration from the Allure config file.",
46
+ examples: [
47
+ ["logout", "Log out from the Allure Service using the default configuration"],
48
+ ["logout --config custom-config.js", "Log out from the Allure Service using a custom configuration file"],
49
+ ],
50
+ });
@@ -1,8 +1,11 @@
1
- type CommandOptions = {
2
- config?: string;
3
- port?: number;
4
- live: boolean;
5
- };
6
- export declare const OpenCommandAction: (reportDir: string | undefined, options: CommandOptions) => Promise<void>;
7
- export declare const OpenCommand: (cli: import("cac").CAC) => void;
8
- export {};
1
+ import { Command } from "clipanion";
2
+ export declare class OpenCommand extends Command {
3
+ static paths: string[][];
4
+ static usage: import("clipanion").Usage;
5
+ reportDir: string | undefined;
6
+ config: string | undefined;
7
+ port: string | undefined;
8
+ live: boolean | undefined;
9
+ cwd: string | undefined;
10
+ execute(): Promise<void>;
11
+ }
@@ -1,39 +1,39 @@
1
- import { readRuntimeConfig } from "@allure/core";
2
- import { serve } from "@allure/static-server";
3
- import { createCommand } from "../utils/commands.js";
4
- export const OpenCommandAction = async (reportDir, options) => {
5
- const { config: configPath, port, live } = options;
6
- const config = await readRuntimeConfig(configPath, undefined, reportDir);
7
- await serve({
8
- port: port,
9
- servePath: config.output,
10
- live: Boolean(live),
11
- open: true,
12
- });
13
- };
14
- export const OpenCommand = createCommand({
15
- name: "open [reportDir]",
1
+ import { readConfig } from "@allurereport/core";
2
+ import { serve } from "@allurereport/static-server";
3
+ import { Command, Option } from "clipanion";
4
+ export class OpenCommand extends Command {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.reportDir = Option.String({ required: false, name: "The directory with Allure results" });
8
+ this.config = Option.String("--config,-c", {
9
+ description: "The path Allure config file",
10
+ });
11
+ this.port = Option.String("--port", {
12
+ description: "The port to serve the reports on. If not set, the server starts on a random port",
13
+ });
14
+ this.live = Option.Boolean("--live", {
15
+ description: "Reload pages on any file change in the served directory",
16
+ });
17
+ this.cwd = Option.String("--cwd", {
18
+ description: "The working directory for the command to run (default: current working directory)",
19
+ });
20
+ }
21
+ async execute() {
22
+ const config = await readConfig(this.cwd, this.config, { output: this.reportDir ?? "./allure-report" });
23
+ await serve({
24
+ port: this.port ? parseInt(this.port, 10) : undefined,
25
+ servePath: config.output,
26
+ live: this.live ?? false,
27
+ open: true,
28
+ });
29
+ }
30
+ }
31
+ OpenCommand.paths = [["open"]];
32
+ OpenCommand.usage = Command.Usage({
16
33
  description: "Serves specified directory",
17
- options: [
18
- [
19
- "--config, -c <file>",
20
- {
21
- description: "The path Allure config file",
22
- },
23
- ],
24
- [
25
- "--port <string>",
26
- {
27
- description: "The port to serve the reports on. If not set, the server starts on a random port",
28
- },
29
- ],
30
- [
31
- "--live",
32
- {
33
- description: "Reload pages on any file change in the served directory",
34
- default: false,
35
- },
36
- ],
34
+ details: "This command serves the specified report directory and opens it in the default browser.",
35
+ examples: [
36
+ ["open", "Serve the default report directory"],
37
+ ["open custom-report --port 8080 --live", "Serve the custom-report directory on port 8080 with live reload"],
37
38
  ],
38
- action: OpenCommandAction,
39
39
  });
@@ -0,0 +1,9 @@
1
+ import { Command } from "clipanion";
2
+ export declare class ProjectsCreateCommand extends Command {
3
+ static paths: string[][];
4
+ static usage: import("clipanion").Usage;
5
+ projectName: string | undefined;
6
+ config: string | undefined;
7
+ cwd: string | undefined;
8
+ execute(): Promise<void>;
9
+ }
@@ -0,0 +1,83 @@
1
+ import { getGitRepoName, readConfig } from "@allurereport/core";
2
+ import { AllureServiceClient, KnownError } from "@allurereport/service";
3
+ import { Command, Option } from "clipanion";
4
+ import * as console from "node:console";
5
+ import { exit } from "node:process";
6
+ import prompts from "prompts";
7
+ import { green, red } from "yoctocolors";
8
+ import { logError } from "../../utils/logs.js";
9
+ export class ProjectsCreateCommand extends Command {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.projectName = Option.String({ required: false, name: "Project name" });
13
+ this.config = Option.String("--config,-c", {
14
+ description: "The path Allure config file",
15
+ });
16
+ this.cwd = Option.String("--cwd", {
17
+ description: "The working directory for the command to run (default: current working directory)",
18
+ });
19
+ }
20
+ async execute() {
21
+ const config = await readConfig(this.cwd, this.config);
22
+ if (!config?.allureService?.url) {
23
+ console.error(red("No Allure Service URL is provided. Please provide it in the `allureService.url` field in the `allure.config.js` file"));
24
+ exit(1);
25
+ return;
26
+ }
27
+ const serviceClient = new AllureServiceClient(config.allureService);
28
+ let name = this.projectName;
29
+ if (!name) {
30
+ try {
31
+ name = await getGitRepoName();
32
+ }
33
+ catch (ignored) { }
34
+ }
35
+ if (!name) {
36
+ const res = await prompts({
37
+ type: "text",
38
+ name: "name",
39
+ message: "Enter project name",
40
+ });
41
+ name = res?.name;
42
+ }
43
+ if (!name) {
44
+ console.error(red("No project name provided!"));
45
+ exit(1);
46
+ return;
47
+ }
48
+ try {
49
+ const project = await serviceClient.createProject({
50
+ name,
51
+ });
52
+ const lines = [
53
+ `The "${green(project.name)}" has been created. Insert following code into your Allure Config file, to enable Allure Service features for the project:`,
54
+ "",
55
+ green("{"),
56
+ green(" allureService: {"),
57
+ green(` project: "${project.name}"`),
58
+ green(" }"),
59
+ green("}"),
60
+ ];
61
+ console.info(lines.join("\n"));
62
+ }
63
+ catch (error) {
64
+ if (error instanceof KnownError) {
65
+ console.error(red(error.message));
66
+ exit(1);
67
+ return;
68
+ }
69
+ await logError("Failed to create project due to unexpected error", error);
70
+ exit(1);
71
+ }
72
+ }
73
+ }
74
+ ProjectsCreateCommand.paths = [["projects", "create"]];
75
+ ProjectsCreateCommand.usage = Command.Usage({
76
+ category: "Allure Service Projects",
77
+ description: "Creates a new project",
78
+ details: "This command creates a new project in the Allure Service.",
79
+ examples: [
80
+ ["project create my-project", "Create a new project named 'my-project'"],
81
+ ["project create", "Create a new project with a name from git repo or prompt for a name"],
82
+ ],
83
+ });
@@ -0,0 +1,10 @@
1
+ import { Command } from "clipanion";
2
+ export declare class ProjectsDeleteCommand extends Command {
3
+ static paths: string[][];
4
+ static usage: import("clipanion").Usage;
5
+ projectName: string;
6
+ force: boolean | undefined;
7
+ config: string | undefined;
8
+ cwd: string | undefined;
9
+ execute(): Promise<void>;
10
+ }
@@ -0,0 +1,68 @@
1
+ import { readConfig } from "@allurereport/core";
2
+ import { AllureServiceClient, KnownError } from "@allurereport/service";
3
+ import { Command, Option } from "clipanion";
4
+ import * as console from "node:console";
5
+ import { exit } from "node:process";
6
+ import prompts from "prompts";
7
+ import { green, red } from "yoctocolors";
8
+ import { logError } from "../../utils/logs.js";
9
+ export class ProjectsDeleteCommand extends Command {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.projectName = Option.String({ required: true, name: "Project name" });
13
+ this.force = Option.Boolean("--force", {
14
+ description: "Delete project with no confirmation",
15
+ });
16
+ this.config = Option.String("--config,-c", {
17
+ description: "The path Allure config file",
18
+ });
19
+ this.cwd = Option.String("--cwd", {
20
+ description: "The working directory for the command to run (default: current working directory)",
21
+ });
22
+ }
23
+ async execute() {
24
+ const config = await readConfig(this.cwd, this.config);
25
+ if (!config?.allureService?.url) {
26
+ console.error(red("No Allure Service URL is provided. Please provide it in the `allureService.url` field in the `allure.config.js` file"));
27
+ exit(1);
28
+ return;
29
+ }
30
+ const serviceClient = new AllureServiceClient(config.allureService);
31
+ if (!this.force) {
32
+ const res = await prompts({
33
+ type: "confirm",
34
+ name: "value",
35
+ message: `Are you sure you want to delete project "${this.projectName}"?`,
36
+ });
37
+ if (!res.value) {
38
+ exit(0);
39
+ return;
40
+ }
41
+ }
42
+ try {
43
+ await serviceClient.deleteProject({
44
+ name: this.projectName,
45
+ });
46
+ console.info(green("Project has been deleted"));
47
+ }
48
+ catch (error) {
49
+ if (error instanceof KnownError) {
50
+ console.error(red(error.message));
51
+ exit(1);
52
+ return;
53
+ }
54
+ await logError("Failed to delete project due to unexpected error", error);
55
+ exit(1);
56
+ }
57
+ }
58
+ }
59
+ ProjectsDeleteCommand.paths = [["projects", "delete"]];
60
+ ProjectsDeleteCommand.usage = Command.Usage({
61
+ category: "Allure Service Projects",
62
+ description: "Deletes a project",
63
+ details: "This command deletes a project from the Allure Service.",
64
+ examples: [
65
+ ["project delete my-project", "Delete the project named 'my-project' (with confirmation)"],
66
+ ["project delete my-project --force", "Delete the project named 'my-project' without confirmation"],
67
+ ],
68
+ });
@@ -0,0 +1,3 @@
1
+ export * from "./create.js";
2
+ export * from "./delete.js";
3
+ export * from "./list.js";
@@ -0,0 +1,3 @@
1
+ export * from "./create.js";
2
+ export * from "./delete.js";
3
+ export * from "./list.js";
@@ -0,0 +1,8 @@
1
+ import { Command } from "clipanion";
2
+ export declare class ProjectsListCommand extends Command {
3
+ static paths: string[][];
4
+ static usage: import("clipanion").Usage;
5
+ config: string | undefined;
6
+ cwd: string | undefined;
7
+ execute(): Promise<void>;
8
+ }