allure 3.0.0-beta.16 → 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.
- package/dist/commands/allure2.d.ts +15 -13
- package/dist/commands/allure2.js +67 -79
- package/dist/commands/awesome.d.ts +18 -15
- package/dist/commands/awesome.js +79 -99
- package/dist/commands/classic.d.ts +15 -13
- package/dist/commands/classic.js +67 -79
- package/dist/commands/csv.d.ts +13 -11
- package/dist/commands/csv.js +59 -65
- package/dist/commands/dashboard.d.ts +15 -13
- package/dist/commands/dashboard.js +67 -78
- package/dist/commands/generate.d.ts +11 -9
- package/dist/commands/generate.js +44 -36
- package/dist/commands/history.d.ts +9 -7
- package/dist/commands/history.js +31 -28
- package/dist/commands/knownIssue.d.ts +8 -6
- package/dist/commands/knownIssue.js +30 -23
- package/dist/commands/log.d.ts +12 -9
- package/dist/commands/log.js +54 -58
- package/dist/commands/login.d.ts +8 -7
- package/dist/commands/login.js +39 -36
- package/dist/commands/logout.d.ts +8 -7
- package/dist/commands/logout.js +39 -36
- package/dist/commands/open.d.ts +11 -9
- package/dist/commands/open.js +34 -40
- package/dist/commands/projects/create.d.ts +9 -7
- package/dist/commands/projects/create.js +70 -66
- package/dist/commands/projects/delete.d.ts +10 -7
- package/dist/commands/projects/delete.js +55 -61
- package/dist/commands/projects/list.d.ts +8 -7
- package/dist/commands/projects/list.js +62 -62
- package/dist/commands/qualityGate.d.ts +9 -7
- package/dist/commands/qualityGate.js +46 -42
- package/dist/commands/run.d.ts +13 -10
- package/dist/commands/run.js +102 -111
- package/dist/commands/slack.d.ts +9 -7
- package/dist/commands/slack.js +51 -48
- package/dist/commands/testplan.d.ts +8 -6
- package/dist/commands/testplan.js +36 -29
- package/dist/commands/watch.d.ts +12 -10
- package/dist/commands/watch.js +103 -99
- package/dist/commands/whoami.d.ts +8 -7
- package/dist/commands/whoami.js +44 -38
- package/dist/index.js +31 -35
- package/package.json +19 -19
- package/dist/utils/commands.d.ts +0 -16
- package/dist/utils/commands.js +0 -16
package/dist/commands/log.js
CHANGED
|
@@ -1,68 +1,64 @@
|
|
|
1
|
-
import { AllureReport,
|
|
1
|
+
import { AllureReport, readConfig } from "@allurereport/core";
|
|
2
2
|
import LogPlugin from "@allurereport/plugin-log";
|
|
3
|
+
import { Command, Option } from "clipanion";
|
|
3
4
|
import * as console from "node:console";
|
|
4
5
|
import { realpath } from "node:fs/promises";
|
|
5
6
|
import process from "node:process";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
description: "The path Allure config file",
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
[
|
|
40
|
-
"--cwd <cwd>",
|
|
41
|
-
{
|
|
42
|
-
description: "The working directory for the command to run (Default: current working directory)",
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
[
|
|
46
|
-
"--group-by <label>",
|
|
47
|
-
{
|
|
48
|
-
description: "Group tests by type (none, suite, feature, package, etc.)",
|
|
49
|
-
default: "suite",
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
[
|
|
53
|
-
"--all-steps",
|
|
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 = [
|
|
54
37
|
{
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
id: "log",
|
|
39
|
+
enabled: true,
|
|
40
|
+
options: defaultLogOptions,
|
|
41
|
+
plugin: new LogPlugin(defaultLogOptions),
|
|
57
42
|
},
|
|
58
|
-
]
|
|
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"],
|
|
59
59
|
[
|
|
60
|
-
"--with-trace",
|
|
61
|
-
|
|
62
|
-
description: "Print stack trace for failed tests",
|
|
63
|
-
default: false,
|
|
64
|
-
},
|
|
60
|
+
"log ./allure-results --all-steps --with-trace",
|
|
61
|
+
"Print results with all steps and stack traces from the ./allure-results directory",
|
|
65
62
|
],
|
|
66
63
|
],
|
|
67
|
-
action: LogCommandAction,
|
|
68
64
|
});
|
package/dist/commands/login.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
+
}
|
package/dist/commands/login.js
CHANGED
|
@@ -1,47 +1,50 @@
|
|
|
1
1
|
import { readConfig } from "@allurereport/core";
|
|
2
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";
|
|
3
6
|
import { green, red } from "yoctocolors";
|
|
4
|
-
import { createCommand } from "../utils/commands.js";
|
|
5
7
|
import { logError } from "../utils/logs.js";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
});
|
|
13
17
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
catch (error) {
|
|
20
|
-
if (error instanceof KnownError) {
|
|
21
|
-
console.error(red(error.message));
|
|
22
|
-
process.exit(1);
|
|
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
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
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
|
+
}
|
|
27
39
|
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
}
|
|
41
|
+
LoginCommand.paths = [["login"]];
|
|
42
|
+
LoginCommand.usage = Command.Usage({
|
|
43
|
+
category: "Allure Service",
|
|
31
44
|
description: "Logs in to the Allure Service",
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
description: "The path Allure config file",
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
[
|
|
40
|
-
"--cwd <cwd>",
|
|
41
|
-
{
|
|
42
|
-
description: "The working directory for the command to run (default: current working directory)",
|
|
43
|
-
},
|
|
44
|
-
],
|
|
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"],
|
|
45
49
|
],
|
|
46
|
-
action: LoginCommandAction,
|
|
47
50
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
+
}
|
package/dist/commands/logout.js
CHANGED
|
@@ -1,47 +1,50 @@
|
|
|
1
1
|
import { readConfig } from "@allurereport/core";
|
|
2
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";
|
|
3
6
|
import { green, red } from "yoctocolors";
|
|
4
|
-
import { createCommand } from "../utils/commands.js";
|
|
5
7
|
import { logError } from "../utils/logs.js";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
});
|
|
13
17
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
catch (error) {
|
|
20
|
-
if (error instanceof KnownError) {
|
|
21
|
-
console.error(red(error.message));
|
|
22
|
-
process.exit(1);
|
|
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
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
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
|
+
}
|
|
27
39
|
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
}
|
|
41
|
+
LogoutCommand.paths = [["logout"]];
|
|
42
|
+
LogoutCommand.usage = Command.Usage({
|
|
43
|
+
category: "Allure Service",
|
|
31
44
|
description: "Logs out from the Allure Service",
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
description: "The path Allure config file",
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
[
|
|
40
|
-
"--cwd <cwd>",
|
|
41
|
-
{
|
|
42
|
-
description: "The working directory for the command to run (default: current working directory)",
|
|
43
|
-
},
|
|
44
|
-
],
|
|
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"],
|
|
45
49
|
],
|
|
46
|
-
action: LogoutCommandAction,
|
|
47
50
|
});
|
package/dist/commands/open.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
}
|
package/dist/commands/open.js
CHANGED
|
@@ -1,45 +1,39 @@
|
|
|
1
1
|
import { readConfig } from "@allurereport/core";
|
|
2
2
|
import { serve } from "@allurereport/static-server";
|
|
3
|
-
import {
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
],
|
|
37
|
-
[
|
|
38
|
-
"--cwd <cwd>",
|
|
39
|
-
{
|
|
40
|
-
description: "The working directory for the command to run (default: current working directory)",
|
|
41
|
-
},
|
|
42
|
-
],
|
|
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"],
|
|
43
38
|
],
|
|
44
|
-
action: OpenCommandAction,
|
|
45
39
|
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
+
}
|
|
@@ -1,79 +1,83 @@
|
|
|
1
1
|
import { getGitRepoName, readConfig } from "@allurereport/core";
|
|
2
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";
|
|
3
6
|
import prompts from "prompts";
|
|
4
7
|
import { green, red } from "yoctocolors";
|
|
5
|
-
import { createCommand } from "../../utils/commands.js";
|
|
6
8
|
import { logError } from "../../utils/logs.js";
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const serviceClient = new AllureServiceClient(config.allureService);
|
|
16
|
-
let name = projectName;
|
|
17
|
-
if (!name) {
|
|
18
|
-
try {
|
|
19
|
-
name = await getGitRepoName();
|
|
20
|
-
}
|
|
21
|
-
catch (ignored) { }
|
|
22
|
-
}
|
|
23
|
-
if (!name) {
|
|
24
|
-
const res = await prompts({
|
|
25
|
-
type: "text",
|
|
26
|
-
name: "name",
|
|
27
|
-
message: "Enter project name",
|
|
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",
|
|
28
15
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (!name) {
|
|
32
|
-
console.error(red("No project name provided!"));
|
|
33
|
-
process.exit(1);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
const project = await serviceClient.createProject({
|
|
38
|
-
name,
|
|
16
|
+
this.cwd = Option.String("--cwd", {
|
|
17
|
+
description: "The working directory for the command to run (default: current working directory)",
|
|
39
18
|
});
|
|
40
|
-
const lines = [
|
|
41
|
-
`The "${green(project.name)}" has been created. Insert following code into your Allure Config file, to enable Allure Service features for the project:`,
|
|
42
|
-
"",
|
|
43
|
-
green("{"),
|
|
44
|
-
green(" allureService: {"),
|
|
45
|
-
green(` project: "${project.name}"`),
|
|
46
|
-
green(" }"),
|
|
47
|
-
green("}"),
|
|
48
|
-
];
|
|
49
|
-
console.info(lines.join("\n"));
|
|
50
19
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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);
|
|
55
25
|
return;
|
|
56
26
|
}
|
|
57
|
-
|
|
58
|
-
|
|
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
|
+
}
|
|
59
72
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
[
|
|
72
|
-
"--cwd <cwd>",
|
|
73
|
-
{
|
|
74
|
-
description: "The working directory for the command to run (default: current working directory)",
|
|
75
|
-
},
|
|
76
|
-
],
|
|
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"],
|
|
77
82
|
],
|
|
78
|
-
action: ProjectsCreateCommandAction,
|
|
79
83
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
+
}
|