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.
- package/dist/commands/allure2.d.ts +15 -11
- package/dist/commands/allure2.js +70 -63
- package/dist/commands/awesome.d.ts +18 -13
- package/dist/commands/awesome.js +82 -85
- package/dist/commands/classic.d.ts +15 -11
- package/dist/commands/classic.js +70 -63
- package/dist/commands/csv.d.ts +13 -9
- package/dist/commands/csv.js +62 -45
- package/dist/commands/dashboard.d.ts +15 -11
- package/dist/commands/dashboard.js +70 -61
- package/dist/commands/generate.d.ts +11 -9
- package/dist/commands/generate.js +51 -29
- package/dist/commands/history.d.ts +9 -7
- package/dist/commands/history.js +31 -28
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/index.js +4 -0
- package/dist/commands/knownIssue.d.ts +8 -6
- package/dist/commands/knownIssue.js +30 -23
- package/dist/commands/log.d.ts +12 -7
- package/dist/commands/log.js +57 -40
- package/dist/commands/login.d.ts +8 -0
- package/dist/commands/login.js +50 -0
- package/dist/commands/logout.d.ts +8 -0
- package/dist/commands/logout.js +50 -0
- package/dist/commands/open.d.ts +11 -9
- package/dist/commands/open.js +34 -40
- package/dist/commands/projects/create.d.ts +9 -0
- package/dist/commands/projects/create.js +83 -0
- package/dist/commands/projects/delete.d.ts +10 -0
- package/dist/commands/projects/delete.js +68 -0
- package/dist/commands/projects/index.d.ts +3 -0
- package/dist/commands/projects/index.js +3 -0
- package/dist/commands/projects/list.d.ts +8 -0
- package/dist/commands/projects/list.js +75 -0
- 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 +109 -104
- package/dist/commands/slack.d.ts +9 -5
- package/dist/commands/slack.js +54 -31
- 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 -0
- package/dist/commands/whoami.js +57 -0
- package/dist/index.js +31 -28
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/logs.d.ts +3 -0
- package/dist/utils/logs.js +32 -0
- package/package.json +24 -19
- package/dist/utils/commands.d.ts +0 -16
- package/dist/utils/commands.js +0 -16
|
@@ -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
|
+
}
|
package/dist/commands/run.js
CHANGED
|
@@ -3,13 +3,16 @@ import { createTestPlan } from "@allurereport/core-api";
|
|
|
3
3
|
import { allureResultsDirectoriesWatcher, delayedFileProcessingWatcher, newFilesInDirectoryWatcher, } from "@allurereport/directory-watcher";
|
|
4
4
|
import Awesome from "@allurereport/plugin-awesome";
|
|
5
5
|
import { PathResultFile } from "@allurereport/reader-api";
|
|
6
|
+
import { KnownError } from "@allurereport/service";
|
|
7
|
+
import { Command, Option } from "clipanion";
|
|
6
8
|
import * as console from "node:console";
|
|
7
9
|
import { mkdtemp, realpath, rm, writeFile } from "node:fs/promises";
|
|
8
10
|
import { tmpdir } from "node:os";
|
|
9
11
|
import { join, resolve } from "node:path";
|
|
10
12
|
import process from "node:process";
|
|
11
|
-
import {
|
|
13
|
+
import { red } from "yoctocolors";
|
|
12
14
|
import { logTests, runProcess, terminationOf } from "../utils/index.js";
|
|
15
|
+
import { logError } from "../utils/logs.js";
|
|
13
16
|
const runTests = async (allureReport, cwd, command, commandArgs, environment, silent) => {
|
|
14
17
|
let testProcessStarted = false;
|
|
15
18
|
const allureResultsWatchers = new Map();
|
|
@@ -56,113 +59,115 @@ const runTests = async (allureReport, cwd, command, commandArgs, environment, si
|
|
|
56
59
|
await processWatcher.abort();
|
|
57
60
|
return code;
|
|
58
61
|
};
|
|
59
|
-
export
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
export class RunCommand extends Command {
|
|
63
|
+
constructor() {
|
|
64
|
+
super(...arguments);
|
|
65
|
+
this.config = Option.String("--config,-c", {
|
|
66
|
+
description: "The path Allure config file",
|
|
67
|
+
});
|
|
68
|
+
this.cwd = Option.String("--cwd", {
|
|
69
|
+
description: "The working directory for the command to run (default: current working directory)",
|
|
70
|
+
});
|
|
71
|
+
this.output = Option.String("--output,-o", {
|
|
72
|
+
description: "The output file name, allure.csv by default. Accepts absolute paths (default: ./allure-report)",
|
|
73
|
+
});
|
|
74
|
+
this.reportName = Option.String("--report-name,--name", {
|
|
75
|
+
description: "The report name (default: Allure Report)",
|
|
76
|
+
});
|
|
77
|
+
this.rerun = Option.String("--rerun", {
|
|
78
|
+
description: "The number of reruns for failed tests (default: 0)",
|
|
79
|
+
});
|
|
80
|
+
this.silent = Option.Boolean("--silent", {
|
|
81
|
+
description: "Don't pipe the process output logs to console (default: 0)",
|
|
82
|
+
});
|
|
83
|
+
this.commandToRun = Option.Proxy();
|
|
63
84
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
69
|
-
const command = args[0];
|
|
70
|
-
const commandArgs = args.slice(1);
|
|
71
|
-
const cwd = await realpath(options.cwd ?? process.cwd());
|
|
72
|
-
console.log(`${command} ${commandArgs.join(" ")}`);
|
|
73
|
-
const { config: configPath, output, reportName, rerun: maxRerun = 0, silent = false } = options;
|
|
74
|
-
const config = await readConfig(cwd, configPath, { output, name: reportName });
|
|
75
|
-
try {
|
|
76
|
-
await rm(config.output, { recursive: true });
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
if (!isFileNotFoundError(e)) {
|
|
80
|
-
console.error("could not clean output directory", e);
|
|
85
|
+
async execute() {
|
|
86
|
+
const args = this.commandToRun.filter((arg) => arg !== "--");
|
|
87
|
+
if (!args || !args.length) {
|
|
88
|
+
throw new Error("expecting command to be specified after --, e.g. allure run -- npm run test");
|
|
81
89
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
90
|
+
const before = new Date().getTime();
|
|
91
|
+
process.on("exit", (exitCode) => {
|
|
92
|
+
const after = new Date().getTime();
|
|
93
|
+
console.log(`exit code ${exitCode} (${after - before}ms)`);
|
|
94
|
+
});
|
|
95
|
+
const command = args[0];
|
|
96
|
+
const commandArgs = args.slice(1);
|
|
97
|
+
const cwd = await realpath(this.cwd ?? process.cwd());
|
|
98
|
+
console.log(`${command} ${commandArgs.join(" ")}`);
|
|
99
|
+
const maxRerun = this.rerun ? parseInt(this.rerun, 10) : 0;
|
|
100
|
+
const silent = this.silent ?? false;
|
|
101
|
+
const config = await readConfig(cwd, this.config, { output: this.output, name: this.reportName });
|
|
102
|
+
try {
|
|
103
|
+
await rm(config.output, { recursive: true });
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
if (!isFileNotFoundError(e)) {
|
|
107
|
+
console.error("could not clean output directory", e);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
const allureReport = new AllureReport({
|
|
112
|
+
...config,
|
|
113
|
+
realTime: false,
|
|
114
|
+
plugins: [
|
|
115
|
+
...(config.plugins?.length
|
|
116
|
+
? config.plugins
|
|
117
|
+
: [
|
|
118
|
+
{
|
|
119
|
+
id: "awesome",
|
|
120
|
+
enabled: true,
|
|
121
|
+
options: {},
|
|
122
|
+
plugin: new Awesome({
|
|
123
|
+
reportName: config.name,
|
|
124
|
+
}),
|
|
125
|
+
},
|
|
126
|
+
]),
|
|
127
|
+
],
|
|
128
|
+
});
|
|
129
|
+
await allureReport.start();
|
|
130
|
+
let code = await runTests(allureReport, cwd, command, commandArgs, {}, silent);
|
|
131
|
+
for (let rerun = 0; rerun < maxRerun; rerun++) {
|
|
132
|
+
const failed = await allureReport.store.failedTestResults();
|
|
133
|
+
if (failed.length === 0) {
|
|
134
|
+
console.log("no failed tests is detected.");
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
const testPlan = createTestPlan(failed);
|
|
138
|
+
console.log(`rerun number ${rerun} of ${testPlan.tests.length} tests:`);
|
|
139
|
+
logTests(failed);
|
|
140
|
+
const tmpDir = await mkdtemp(join(tmpdir(), "allure-run-"));
|
|
141
|
+
const testPlanPath = resolve(tmpDir, `${rerun}-testplan.json`);
|
|
142
|
+
await writeFile(testPlanPath, JSON.stringify(testPlan));
|
|
143
|
+
code = await runTests(allureReport, cwd, command, commandArgs, {
|
|
144
|
+
ALLURE_TESTPLAN_PATH: testPlanPath,
|
|
145
|
+
ALLURE_RERUN: `${rerun}`,
|
|
146
|
+
}, silent);
|
|
147
|
+
await rm(tmpDir, { recursive: true });
|
|
148
|
+
logTests(await allureReport.store.allTestResults());
|
|
149
|
+
}
|
|
150
|
+
await allureReport.done();
|
|
151
|
+
await allureReport.validate();
|
|
152
|
+
process.exit(code ?? allureReport.exitCode);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
if (error instanceof KnownError) {
|
|
156
|
+
console.error(red(error.message));
|
|
157
|
+
process.exit(1);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
await logError("Failed to run tests using Allure due to unexpected error", error);
|
|
161
|
+
process.exit(1);
|
|
108
162
|
}
|
|
109
|
-
const testPlan = createTestPlan(failed);
|
|
110
|
-
console.log(`rerun number ${rerun} of ${testPlan.tests.length} tests:`);
|
|
111
|
-
logTests(failed);
|
|
112
|
-
const tmpDir = await mkdtemp(join(tmpdir(), "allure-run-"));
|
|
113
|
-
const testPlanPath = resolve(tmpDir, `${rerun}-testplan.json`);
|
|
114
|
-
await writeFile(testPlanPath, JSON.stringify(testPlan));
|
|
115
|
-
code = await runTests(allureReport, cwd, command, commandArgs, {
|
|
116
|
-
ALLURE_TESTPLAN_PATH: testPlanPath,
|
|
117
|
-
ALLURE_RERUN: `${rerun}`,
|
|
118
|
-
}, silent);
|
|
119
|
-
await rm(tmpDir, { recursive: true });
|
|
120
|
-
logTests(await allureReport.store.allTestResults());
|
|
121
163
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
};
|
|
126
|
-
export const RunCommand = createCommand({
|
|
127
|
-
name: "run",
|
|
164
|
+
}
|
|
165
|
+
RunCommand.paths = [["run"]];
|
|
166
|
+
RunCommand.usage = Command.Usage({
|
|
128
167
|
description: "Run specified command",
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
description: "The path Allure config file",
|
|
134
|
-
},
|
|
135
|
-
],
|
|
136
|
-
[
|
|
137
|
-
"--cwd <cwd>",
|
|
138
|
-
{
|
|
139
|
-
description: "The working directory for the command to run (Default: current working directory)",
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
[
|
|
143
|
-
"--output, -o <file>",
|
|
144
|
-
{
|
|
145
|
-
description: "The output file name, allure.csv by default. Accepts absolute paths (Default: ./allure-report)",
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
[
|
|
149
|
-
"--report-name, --name <string>",
|
|
150
|
-
{
|
|
151
|
-
description: "The report name (Default: Allure Report)",
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
[
|
|
155
|
-
"--rerun <number>",
|
|
156
|
-
{
|
|
157
|
-
description: "The number of reruns for failed tests (Default: 0)",
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
[
|
|
161
|
-
"--silent",
|
|
162
|
-
{
|
|
163
|
-
description: "Don't pipe the process output logs to console (Default: 0)",
|
|
164
|
-
},
|
|
165
|
-
],
|
|
168
|
+
details: "This command runs the specified command and collects Allure results.",
|
|
169
|
+
examples: [
|
|
170
|
+
["run -- npm run test", "Run npm run test and collect Allure results"],
|
|
171
|
+
["run --rerun 3 -- npm run test", "Run npm run test and rerun failed tests up to 3 times"],
|
|
166
172
|
],
|
|
167
|
-
action: RunCommandAction,
|
|
168
173
|
});
|
package/dist/commands/slack.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { Command } from "clipanion";
|
|
2
|
+
export declare class SlackCommand extends Command {
|
|
3
|
+
static paths: string[][];
|
|
4
|
+
static usage: import("clipanion").Usage;
|
|
5
|
+
resultsDir: string;
|
|
6
|
+
config: string | undefined;
|
|
7
|
+
cwd: string | undefined;
|
|
2
8
|
token: string;
|
|
3
9
|
channel: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare const SlackCommand: (cli: import("cac").CAC) => void;
|
|
7
|
-
export {};
|
|
10
|
+
execute(): Promise<void>;
|
|
11
|
+
}
|
package/dist/commands/slack.js
CHANGED
|
@@ -1,38 +1,61 @@
|
|
|
1
|
-
import { AllureReport,
|
|
1
|
+
import { AllureReport, readConfig } from "@allurereport/core";
|
|
2
|
+
import SlackPlugin from "@allurereport/plugin-slack";
|
|
3
|
+
import { Command, Option } from "clipanion";
|
|
2
4
|
import * as console from "node:console";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
5
|
+
import { realpath } from "node:fs/promises";
|
|
6
|
+
import process from "node:process";
|
|
7
|
+
export class SlackCommand 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.token = Option.String("--token,-t", {
|
|
18
|
+
description: "Slack Bot User OAuth Token",
|
|
19
|
+
required: true,
|
|
20
|
+
});
|
|
21
|
+
this.channel = Option.String("--channel", {
|
|
22
|
+
description: "Slack channelId",
|
|
23
|
+
required: true,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async execute() {
|
|
27
|
+
const cwd = await realpath(this.cwd ?? process.cwd());
|
|
28
|
+
const before = new Date().getTime();
|
|
29
|
+
const defaultSlackOptions = {
|
|
30
|
+
token: this.token,
|
|
31
|
+
channel: this.channel,
|
|
32
|
+
};
|
|
33
|
+
const config = await readConfig(cwd, this.config);
|
|
34
|
+
config.plugins = [
|
|
26
35
|
{
|
|
27
|
-
|
|
36
|
+
id: "slack",
|
|
37
|
+
enabled: true,
|
|
38
|
+
options: defaultSlackOptions,
|
|
39
|
+
plugin: new SlackPlugin(defaultSlackOptions),
|
|
28
40
|
},
|
|
29
|
-
]
|
|
41
|
+
];
|
|
42
|
+
const allureReport = new AllureReport(config);
|
|
43
|
+
await allureReport.start();
|
|
44
|
+
await allureReport.readDirectory(this.resultsDir);
|
|
45
|
+
await allureReport.done();
|
|
46
|
+
const after = new Date().getTime();
|
|
47
|
+
console.log(`the report successfully generated (${after - before}ms)`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
SlackCommand.paths = [["slack"]];
|
|
51
|
+
SlackCommand.usage = Command.Usage({
|
|
52
|
+
category: "Reports",
|
|
53
|
+
description: "Posts test results into Slack Channel",
|
|
54
|
+
details: "This command posts test results from the provided Allure Results directory to a Slack channel.",
|
|
55
|
+
examples: [
|
|
30
56
|
[
|
|
31
|
-
"--
|
|
32
|
-
|
|
33
|
-
description: "Slack channelId",
|
|
34
|
-
},
|
|
57
|
+
"slack ./allure-results --token xoxb-token --channel C12345",
|
|
58
|
+
"Post test results from the ./allure-results directory to the specified Slack channel",
|
|
35
59
|
],
|
|
36
60
|
],
|
|
37
|
-
action: SlackCommandAction,
|
|
38
61
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Command } from "clipanion";
|
|
2
|
+
export declare class TestPlanCommand 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,38 +1,45 @@
|
|
|
1
1
|
import { AllureReport, resolveConfig } from "@allurereport/core";
|
|
2
|
+
import { Command, Option } from "clipanion";
|
|
2
3
|
import * as console from "node:console";
|
|
3
4
|
import { basename, dirname, resolve } from "node:path";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
export class TestPlanCommand 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 before = new Date().getTime();
|
|
15
|
+
const resolved = resolve(this.output ?? "./testplan.json");
|
|
16
|
+
const output = dirname(resolved);
|
|
17
|
+
const fileName = basename(resolved);
|
|
18
|
+
const config = await resolveConfig({
|
|
19
|
+
output: output,
|
|
20
|
+
plugins: {
|
|
21
|
+
"@allurereport/plugin-testplan": {
|
|
22
|
+
options: { fileName },
|
|
23
|
+
},
|
|
15
24
|
},
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
});
|
|
26
|
+
const allureReport = new AllureReport(config);
|
|
27
|
+
await allureReport.start();
|
|
28
|
+
await allureReport.readDirectory(this.resultsDir);
|
|
29
|
+
await allureReport.done();
|
|
30
|
+
const after = new Date().getTime();
|
|
31
|
+
console.log(`the report successfully generated (${after - before}ms)`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
TestPlanCommand.paths = [["testplan"]];
|
|
35
|
+
TestPlanCommand.usage = Command.Usage({
|
|
27
36
|
description: "Generates testplan.json based on provided Allure Results",
|
|
28
|
-
|
|
37
|
+
details: "This command generates a testplan.json file from the provided Allure Results directory.",
|
|
38
|
+
examples: [
|
|
39
|
+
["testplan ./allure-results", "Generate a testplan.json file from the ./allure-results directory"],
|
|
29
40
|
[
|
|
30
|
-
"--output
|
|
31
|
-
|
|
32
|
-
description: "The output file name. Absolute paths are accepted as well",
|
|
33
|
-
default: "testplan.json",
|
|
34
|
-
},
|
|
41
|
+
"testplan ./allure-results --output custom-testplan.json",
|
|
42
|
+
"Generate a custom-testplan.json file from the ./allure-results directory",
|
|
35
43
|
],
|
|
36
44
|
],
|
|
37
|
-
action: TestPlanCommandAction,
|
|
38
45
|
});
|
package/dist/commands/watch.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { Command } from "clipanion";
|
|
2
|
+
export declare class WatchCommand 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
|
+
port: string | undefined;
|
|
11
|
+
execute(): Promise<void>;
|
|
12
|
+
}
|