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
|
@@ -1,74 +1,68 @@
|
|
|
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 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
|
-
process.exit(1);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const serviceClient = new AllureServiceClient(config.allureService);
|
|
17
|
-
if (!projectName) {
|
|
18
|
-
console.error(red("No project name is provided"));
|
|
19
|
-
process.exit(1);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (!force) {
|
|
23
|
-
const res = await prompts({
|
|
24
|
-
type: "confirm",
|
|
25
|
-
name: "value",
|
|
26
|
-
message: `Are you sure you want to delete project "${projectName}"?`,
|
|
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",
|
|
27
15
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
await serviceClient.deleteProject({
|
|
35
|
-
name: projectName,
|
|
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)",
|
|
36
21
|
});
|
|
37
|
-
console.info(green("Project has been deleted"));
|
|
38
22
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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);
|
|
43
28
|
return;
|
|
44
29
|
}
|
|
45
|
-
|
|
46
|
-
|
|
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
|
+
}
|
|
47
57
|
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
default: false,
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
[
|
|
61
|
-
"--config, -c <file>",
|
|
62
|
-
{
|
|
63
|
-
description: "The path Allure config file",
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
[
|
|
67
|
-
"--cwd <cwd>",
|
|
68
|
-
{
|
|
69
|
-
description: "The working directory for the command to run (default: current working directory)",
|
|
70
|
-
},
|
|
71
|
-
],
|
|
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"],
|
|
72
67
|
],
|
|
73
|
-
action: ProjectsDeleteCommandAction,
|
|
74
68
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
+
}
|
|
@@ -1,75 +1,75 @@
|
|
|
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 prompts from "prompts";
|
|
4
7
|
import { green, red, yellow } 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
|
-
|
|
9
|
+
export class ProjectsListCommand extends Command {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.config = Option.String("--config,-c", {
|
|
13
|
+
description: "The path Allure config file",
|
|
14
|
+
});
|
|
15
|
+
this.cwd = Option.String("--cwd", {
|
|
16
|
+
description: "The working directory for the command to run (default: current working directory)",
|
|
17
|
+
});
|
|
14
18
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
async execute() {
|
|
20
|
+
const config = await readConfig(this.cwd, this.config);
|
|
21
|
+
if (!config?.allureService?.url) {
|
|
22
|
+
console.error(red("No Allure Service URL is provided. Please provide it in the `allureService.url` field in the `allure.config.js` file"));
|
|
23
|
+
exit(1);
|
|
20
24
|
return;
|
|
21
25
|
}
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
const serviceClient = new AllureServiceClient(config.allureService);
|
|
27
|
+
try {
|
|
28
|
+
const projects = await serviceClient.projects();
|
|
29
|
+
if (projects.length === 0) {
|
|
30
|
+
console.info(yellow("No projects found. Create a new one with `allure project-create` command"));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const res = await prompts({
|
|
34
|
+
type: "select",
|
|
35
|
+
name: "project",
|
|
36
|
+
message: "Select a project",
|
|
37
|
+
choices: projects.map((project) => ({
|
|
38
|
+
title: project.name,
|
|
39
|
+
value: project.name,
|
|
40
|
+
})),
|
|
41
|
+
});
|
|
42
|
+
if (!res?.project) {
|
|
43
|
+
console.error(red("No project selected"));
|
|
44
|
+
exit(1);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const lines = [
|
|
48
|
+
"Insert following code into your Allure Config file, to enable Allure Service features for the project:",
|
|
49
|
+
"",
|
|
50
|
+
green("{"),
|
|
51
|
+
green(" allureService: {"),
|
|
52
|
+
green(` project: "${res.project}"`),
|
|
53
|
+
green(" }"),
|
|
54
|
+
green("}"),
|
|
55
|
+
];
|
|
56
|
+
console.info(lines.join("\n"));
|
|
35
57
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
];
|
|
45
|
-
console.info(lines.join("\n"));
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
if (error instanceof KnownError) {
|
|
49
|
-
console.error(red(error.message));
|
|
50
|
-
process.exit(1);
|
|
51
|
-
return;
|
|
58
|
+
catch (error) {
|
|
59
|
+
if (error instanceof KnownError) {
|
|
60
|
+
console.error(red(error.message));
|
|
61
|
+
exit(1);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
await logError("Failed to get projects due to unexpected error", error);
|
|
65
|
+
exit(1);
|
|
52
66
|
}
|
|
53
|
-
await logError("Failed to get projects due to unexpected error", error);
|
|
54
|
-
process.exit(1);
|
|
55
67
|
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
68
|
+
}
|
|
69
|
+
ProjectsListCommand.paths = [["projects", "list"]];
|
|
70
|
+
ProjectsListCommand.usage = Command.Usage({
|
|
71
|
+
category: "Allure Service Projects",
|
|
59
72
|
description: "Shows list of all available projects for current user",
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"--config, -c <file>",
|
|
63
|
-
{
|
|
64
|
-
description: "The path Allure config file",
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
[
|
|
68
|
-
"--cwd <cwd>",
|
|
69
|
-
{
|
|
70
|
-
description: "The working directory for the command to run (default: current working directory)",
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
],
|
|
74
|
-
action: ProjectsListCommandAction,
|
|
73
|
+
details: "This command lists all available projects for the current user and allows selecting one to get configuration information.",
|
|
74
|
+
examples: [["projects", "List all available projects"]],
|
|
75
75
|
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Command } from "clipanion";
|
|
2
|
+
export declare class QualityGateCommand extends Command {
|
|
3
|
+
static paths: string[][];
|
|
4
|
+
static usage: import("clipanion").Usage;
|
|
5
|
+
resultsDir: string;
|
|
6
|
+
config: string | undefined;
|
|
7
|
+
cwd: string | undefined;
|
|
8
|
+
execute(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -1,52 +1,56 @@
|
|
|
1
1
|
import { AllureReport, readConfig } from "@allurereport/core";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { Command, Option } from "clipanion";
|
|
3
|
+
import * as console from "node:console";
|
|
4
|
+
import { exit } from "node:process";
|
|
4
5
|
import { bold, red } from "yoctocolors";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return;
|
|
6
|
+
export class QualityGateCommand extends Command {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.resultsDir = Option.String({ required: true, name: "The directory with Allure results" });
|
|
10
|
+
this.config = Option.String("--config,-c", {
|
|
11
|
+
description: "The path Allure config file",
|
|
12
|
+
});
|
|
13
|
+
this.cwd = Option.String("--cwd", {
|
|
14
|
+
description: "The working directory for the command to run (default: current working directory)",
|
|
15
|
+
});
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
scope = `(parameter[${result.meta.name}="${result.meta.value}"])`;
|
|
27
|
-
break;
|
|
17
|
+
async execute() {
|
|
18
|
+
const fullConfig = await readConfig(this.cwd, this.config);
|
|
19
|
+
const allureReport = new AllureReport(fullConfig);
|
|
20
|
+
await allureReport.start();
|
|
21
|
+
await allureReport.readDirectory(this.resultsDir);
|
|
22
|
+
await allureReport.done();
|
|
23
|
+
await allureReport.validate();
|
|
24
|
+
if (allureReport.exitCode === 0) {
|
|
25
|
+
return;
|
|
28
26
|
}
|
|
29
|
-
|
|
27
|
+
const failedResults = allureReport.validationResults.filter((result) => !result.success);
|
|
28
|
+
console.error(red(`Quality gate has failed with ${bold(failedResults.length.toString())} errors:\n`));
|
|
29
|
+
for (const result of failedResults) {
|
|
30
|
+
let scope = "";
|
|
31
|
+
switch (result.meta?.type) {
|
|
32
|
+
case "label":
|
|
33
|
+
scope = `(label[${result.meta.name}="${result.meta.value}"])`;
|
|
34
|
+
break;
|
|
35
|
+
case "parameter":
|
|
36
|
+
scope = `(parameter[${result.meta.name}="${result.meta.value}"])`;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
console.error(red(`⨯ ${bold(`${result.rule}${scope}`)}: expected ${result.expected}, actual ${result.actual}`));
|
|
40
|
+
}
|
|
41
|
+
console.error(red("\nThe process has been exited with code 1"));
|
|
42
|
+
exit(allureReport.exitCode);
|
|
30
43
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export const QualityGateCommand = createCommand({
|
|
35
|
-
name: "quality-gate <resultsDir>",
|
|
44
|
+
}
|
|
45
|
+
QualityGateCommand.paths = [["quality-gate"]];
|
|
46
|
+
QualityGateCommand.usage = Command.Usage({
|
|
36
47
|
description: "Returns status code 1 if there any test failure above specified success rate",
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
description: "The path Allure config file",
|
|
42
|
-
},
|
|
43
|
-
],
|
|
48
|
+
details: "This command validates the test results against quality gates defined in the configuration.",
|
|
49
|
+
examples: [
|
|
50
|
+
["quality-gate ./allure-results", "Validate the test results in the ./allure-results directory"],
|
|
44
51
|
[
|
|
45
|
-
"--
|
|
46
|
-
|
|
47
|
-
description: "The working directory for the command to run (Default: current working directory)",
|
|
48
|
-
},
|
|
52
|
+
"quality-gate ./allure-results --config custom-config.js",
|
|
53
|
+
"Validate the test results using a custom configuration file",
|
|
49
54
|
],
|
|
50
55
|
],
|
|
51
|
-
action: QualityGateCommandAction,
|
|
52
56
|
});
|
package/dist/commands/run.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { Command } from "clipanion";
|
|
2
|
+
export declare class RunCommand extends Command {
|
|
3
|
+
static paths: string[][];
|
|
4
|
+
static usage: import("clipanion").Usage;
|
|
5
|
+
config: string | undefined;
|
|
6
|
+
cwd: string | undefined;
|
|
7
|
+
output: string | undefined;
|
|
8
|
+
reportName: string | undefined;
|
|
9
|
+
rerun: string | undefined;
|
|
10
|
+
silent: boolean | undefined;
|
|
11
|
+
commandToRun: string[];
|
|
12
|
+
execute(): Promise<void>;
|
|
13
|
+
}
|