allure 3.8.2 → 3.9.0
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 +1 -1
- package/dist/commands/allure2.js +19 -6
- package/dist/commands/awesome.d.ts +1 -1
- package/dist/commands/awesome.js +19 -6
- package/dist/commands/classic.d.ts +1 -1
- package/dist/commands/classic.js +19 -6
- package/dist/commands/commons/generate.d.ts +1 -1
- package/dist/commands/commons/generate.js +8 -29
- package/dist/commands/commons/run.js +1 -1
- package/dist/commands/csv.d.ts +1 -1
- package/dist/commands/csv.js +16 -6
- package/dist/commands/dashboard.d.ts +1 -1
- package/dist/commands/dashboard.js +19 -6
- package/dist/commands/generate.d.ts +1 -1
- package/dist/commands/generate.js +12 -7
- package/dist/commands/history.d.ts +1 -1
- package/dist/commands/history.js +20 -6
- package/dist/commands/knownIssue.d.ts +1 -1
- package/dist/commands/knownIssue.js +19 -6
- package/dist/commands/log.d.ts +1 -1
- package/dist/commands/log.js +16 -6
- package/dist/commands/open.d.ts +3 -1
- package/dist/commands/open.js +35 -19
- package/dist/commands/qualityGate.d.ts +1 -1
- package/dist/commands/qualityGate.js +19 -20
- package/dist/commands/slack.d.ts +1 -1
- package/dist/commands/slack.js +19 -6
- package/dist/commands/testplan.d.ts +1 -1
- package/dist/commands/testplan.js +18 -5
- package/dist/commands/watch.d.ts +1 -1
- package/dist/commands/watch.js +26 -11
- package/dist/utils/fileSystem.d.ts +6 -0
- package/dist/utils/fileSystem.js +36 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +22 -21
package/dist/commands/log.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import * as console from "node:console";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
2
|
import { realpath } from "node:fs/promises";
|
|
4
3
|
import process, { exit } from "node:process";
|
|
5
4
|
import { AllureReport, readConfig } from "@allurereport/core";
|
|
6
5
|
import LogPlugin from "@allurereport/plugin-log";
|
|
7
6
|
import { Command, Option } from "clipanion";
|
|
8
7
|
import { red } from "yoctocolors";
|
|
8
|
+
import { findAllureResultDirectories } from "../utils/fileSystem.js";
|
|
9
9
|
export class LogCommand extends Command {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
|
-
this.resultsDir = Option.
|
|
12
|
+
this.resultsDir = Option.Rest({
|
|
13
|
+
name: "Patterns to match test results directories in the current working directory (default: ./**/allure-results)",
|
|
14
|
+
});
|
|
13
15
|
this.config = Option.String("--config,-c", {
|
|
14
16
|
description: "The path Allure config file",
|
|
15
17
|
});
|
|
@@ -27,12 +29,13 @@ export class LogCommand extends Command {
|
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
async execute() {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
const cwd = await realpath(this.cwd ?? process.cwd());
|
|
33
|
+
const { resultDirectories, patterns } = await findAllureResultDirectories(cwd, this.resultsDir);
|
|
34
|
+
if (!resultDirectories.length) {
|
|
35
|
+
console.error(red(`No test results directories found matching pattern: ${patterns}`));
|
|
32
36
|
exit(1);
|
|
33
37
|
return;
|
|
34
38
|
}
|
|
35
|
-
const cwd = await realpath(this.cwd ?? process.cwd());
|
|
36
39
|
const before = new Date().getTime();
|
|
37
40
|
const defaultLogOptions = {
|
|
38
41
|
allSteps: this.allSteps ?? false,
|
|
@@ -50,7 +53,9 @@ export class LogCommand extends Command {
|
|
|
50
53
|
];
|
|
51
54
|
const allureReport = new AllureReport(config);
|
|
52
55
|
await allureReport.start();
|
|
53
|
-
|
|
56
|
+
for (const directory of resultDirectories) {
|
|
57
|
+
await allureReport.readDirectory(directory);
|
|
58
|
+
}
|
|
54
59
|
await allureReport.done();
|
|
55
60
|
const after = new Date().getTime();
|
|
56
61
|
console.log(`the report successfully generated (${after - before}ms)`);
|
|
@@ -67,5 +72,10 @@ LogCommand.usage = Command.Usage({
|
|
|
67
72
|
"log ./allure-results --all-steps --with-trace",
|
|
68
73
|
"Print results with all steps and stack traces from the ./allure-results directory",
|
|
69
74
|
],
|
|
75
|
+
["log ./packages/*/allure-results", "Print results from all Allure result directories matching the pattern"],
|
|
76
|
+
[
|
|
77
|
+
"log ./packages/foo/allure-results ./packages/bar/allure-results",
|
|
78
|
+
"Print results from two Allure result directories",
|
|
79
|
+
],
|
|
70
80
|
],
|
|
71
81
|
});
|
package/dist/commands/open.d.ts
CHANGED
|
@@ -2,10 +2,12 @@ import { Command } from "clipanion";
|
|
|
2
2
|
export declare class OpenCommand extends Command {
|
|
3
3
|
static paths: string[][];
|
|
4
4
|
static usage: import("clipanion").Usage;
|
|
5
|
-
resultsDir: string
|
|
5
|
+
resultsDir: string[];
|
|
6
6
|
config: string | undefined;
|
|
7
7
|
port: string | undefined;
|
|
8
8
|
cwd: string | undefined;
|
|
9
9
|
hideLabels: string[] | undefined;
|
|
10
10
|
execute(): Promise<void>;
|
|
11
|
+
private resolveReportPath;
|
|
12
|
+
private reportExists;
|
|
11
13
|
}
|
package/dist/commands/open.js
CHANGED
|
@@ -2,18 +2,18 @@ import { existsSync } from "node:fs";
|
|
|
2
2
|
import { mkdtemp, rm } from "node:fs/promises";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
-
import { cwd as processCwd } from "node:process";
|
|
5
|
+
import { cwd as processCwd, exit } from "node:process";
|
|
6
6
|
import { readConfig } from "@allurereport/core";
|
|
7
7
|
import { serve } from "@allurereport/static-server";
|
|
8
8
|
import { Command, Option } from "clipanion";
|
|
9
|
-
import {
|
|
9
|
+
import { red } from "yoctocolors";
|
|
10
|
+
import { findFilesByGlobs } from "./../utils/fileSystem.js";
|
|
10
11
|
import { generate } from "./commons/generate.js";
|
|
11
12
|
export class OpenCommand extends Command {
|
|
12
13
|
constructor() {
|
|
13
14
|
super(...arguments);
|
|
14
|
-
this.resultsDir = Option.
|
|
15
|
+
this.resultsDir = Option.Rest({
|
|
15
16
|
name: "A report to open or a pattern to match test results directories in the current working directory (default: configured output)",
|
|
16
|
-
required: false,
|
|
17
17
|
});
|
|
18
18
|
this.config = Option.String("--config,-c", {
|
|
19
19
|
description: "The path Allure config file",
|
|
@@ -34,25 +34,15 @@ export class OpenCommand extends Command {
|
|
|
34
34
|
const config = await readConfig(cwd, this.config, {
|
|
35
35
|
port: this.port,
|
|
36
36
|
});
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
? await glob(join(targetFullPath, "**", "summary.json"), {
|
|
40
|
-
mark: true,
|
|
41
|
-
nodir: false,
|
|
42
|
-
absolute: true,
|
|
43
|
-
dot: true,
|
|
44
|
-
windowsPathsNoEscape: true,
|
|
45
|
-
cwd,
|
|
46
|
-
})
|
|
47
|
-
: [];
|
|
48
|
-
if (summaryFiles.length > 0) {
|
|
37
|
+
const servePath = this.resolveReportPath(cwd, this.resultsDir, config.output);
|
|
38
|
+
if (await this.reportExists(servePath)) {
|
|
49
39
|
await serve({
|
|
50
40
|
port: config.port ? parseInt(config.port, 10) : undefined,
|
|
51
|
-
servePath
|
|
41
|
+
servePath,
|
|
52
42
|
open: true,
|
|
53
43
|
});
|
|
54
44
|
}
|
|
55
|
-
else {
|
|
45
|
+
else if (this.resultsDir.length) {
|
|
56
46
|
const tmpDir = await mkdtemp(join(tmpdir(), "allure-report-"));
|
|
57
47
|
const config = await readConfig(cwd, this.config, {
|
|
58
48
|
port: this.port,
|
|
@@ -60,7 +50,7 @@ export class OpenCommand extends Command {
|
|
|
60
50
|
hideLabels,
|
|
61
51
|
});
|
|
62
52
|
await generate({
|
|
63
|
-
resultsDir:
|
|
53
|
+
resultsDir: this.resultsDir,
|
|
64
54
|
cwd,
|
|
65
55
|
config,
|
|
66
56
|
});
|
|
@@ -77,6 +67,24 @@ export class OpenCommand extends Command {
|
|
|
77
67
|
open: true,
|
|
78
68
|
});
|
|
79
69
|
}
|
|
70
|
+
else {
|
|
71
|
+
console.error(red(`A report doesn't exist in ${servePath} and no input was provided to generate.`));
|
|
72
|
+
exit(1);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
resolveReportPath(cwd, inputs, fallback = "allure-report") {
|
|
77
|
+
if (inputs.length <= 1) {
|
|
78
|
+
const [maybeRelativeReportPath = fallback] = inputs;
|
|
79
|
+
return join(cwd, maybeRelativeReportPath);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async reportExists(reportPath) {
|
|
83
|
+
if (reportPath && existsSync(reportPath)) {
|
|
84
|
+
const summaryFiles = await findFilesByGlobs(reportPath, [join("**", "summary.json")]);
|
|
85
|
+
return summaryFiles.length > 0;
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
80
88
|
}
|
|
81
89
|
}
|
|
82
90
|
OpenCommand.paths = [["open"], ["serve"]];
|
|
@@ -86,5 +94,13 @@ OpenCommand.usage = Command.Usage({
|
|
|
86
94
|
examples: [
|
|
87
95
|
["open ./allure-results", "Generate and serve the report based on given test results directory"],
|
|
88
96
|
["open --port 8080 ./allure-report", "Serve the report on port 8080"],
|
|
97
|
+
[
|
|
98
|
+
"open ./packages/*/allure-results",
|
|
99
|
+
"Generate and serve the report from all Allure result directories matching the pattern",
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
"open ./packages/foo/allure-results /packages/bar/allure-results",
|
|
103
|
+
"Generate and serve the report from two Allure result directories",
|
|
104
|
+
],
|
|
89
105
|
],
|
|
90
106
|
});
|
|
@@ -2,7 +2,7 @@ import { Command } from "clipanion";
|
|
|
2
2
|
export declare class QualityGateCommand extends Command {
|
|
3
3
|
static paths: string[][];
|
|
4
4
|
static usage: import("clipanion").Usage;
|
|
5
|
-
resultsDir: string
|
|
5
|
+
resultsDir: string[];
|
|
6
6
|
config: string | undefined;
|
|
7
7
|
fastFail: boolean | undefined;
|
|
8
8
|
maxFailures: number | undefined;
|
|
@@ -3,16 +3,15 @@ import { realpath } from "node:fs/promises";
|
|
|
3
3
|
import { exit, cwd as processCwd } from "node:process";
|
|
4
4
|
import { AllureReport, QualityGateState, readConfig, stringifyQualityGateResults } from "@allurereport/core";
|
|
5
5
|
import { Command, Option } from "clipanion";
|
|
6
|
-
import { glob } from "glob";
|
|
7
6
|
import * as typanion from "typanion";
|
|
8
7
|
import { red } from "yoctocolors";
|
|
9
8
|
import { environmentNameOption, environmentOption, normalizeCommandEnvironmentOptions, resolveCommandEnvironment, } from "../utils/environment.js";
|
|
9
|
+
import { findAllureResultDirectories } from "../utils/fileSystem.js";
|
|
10
10
|
export class QualityGateCommand extends Command {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
|
-
this.resultsDir = Option.
|
|
14
|
-
|
|
15
|
-
name: "Pattern to match test results directories in the current working directory (default: ./**/allure-results)",
|
|
13
|
+
this.resultsDir = Option.Rest({
|
|
14
|
+
name: "Patterns to match test results directories in the current working directory (default: ./**/allure-results)",
|
|
16
15
|
});
|
|
17
16
|
this.config = Option.String("--config,-c", {
|
|
18
17
|
description: "The path Allure config file",
|
|
@@ -48,7 +47,6 @@ export class QualityGateCommand extends Command {
|
|
|
48
47
|
};
|
|
49
48
|
normalizeCommandEnvironmentOptions(environmentOptions);
|
|
50
49
|
const cwd = await realpath(this.cwd ?? processCwd());
|
|
51
|
-
const resultsDir = (this.resultsDir ?? "./**/allure-results").replace(/[\\/]$/, "");
|
|
52
50
|
const { maxFailures, minTestsCount, successRate, fastFail, knownIssues: knownIssuesPath } = this;
|
|
53
51
|
const config = await readConfig(cwd, this.config, {
|
|
54
52
|
knownIssuesPath,
|
|
@@ -83,16 +81,9 @@ export class QualityGateCommand extends Command {
|
|
|
83
81
|
exit(-1);
|
|
84
82
|
return;
|
|
85
83
|
}
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
absolute: true,
|
|
90
|
-
dot: true,
|
|
91
|
-
windowsPathsNoEscape: true,
|
|
92
|
-
cwd,
|
|
93
|
-
})).filter((p) => /(\/|\\)$/.test(p));
|
|
94
|
-
if (resultsDirectories.length === 0) {
|
|
95
|
-
console.error(red(`No test results directories found matching pattern: ${resultsDir}`));
|
|
84
|
+
const { resultDirectories, patterns } = await findAllureResultDirectories(cwd, this.resultsDir);
|
|
85
|
+
if (!resultDirectories.length) {
|
|
86
|
+
console.error(red(`No test results directories found matching pattern: ${patterns}`));
|
|
96
87
|
exit(1);
|
|
97
88
|
return;
|
|
98
89
|
}
|
|
@@ -100,9 +91,9 @@ export class QualityGateCommand extends Command {
|
|
|
100
91
|
const state = new QualityGateState();
|
|
101
92
|
allureReport.realtimeSubscriber.onTestResults(async (trsIds) => {
|
|
102
93
|
const trs = await Promise.all(trsIds.map((id) => allureReport.store.testResultById(id)));
|
|
103
|
-
const
|
|
94
|
+
const nonRetryTrs = trs.filter((tr) => !tr.isRetry);
|
|
104
95
|
const { results, fastFailed } = await allureReport.validate({
|
|
105
|
-
trs:
|
|
96
|
+
trs: nonRetryTrs,
|
|
106
97
|
environment: resolvedEnvironment?.id,
|
|
107
98
|
knownIssues,
|
|
108
99
|
state,
|
|
@@ -114,11 +105,11 @@ export class QualityGateCommand extends Command {
|
|
|
114
105
|
exit(1);
|
|
115
106
|
});
|
|
116
107
|
await allureReport.start();
|
|
117
|
-
for (const
|
|
118
|
-
await allureReport.readDirectory(
|
|
108
|
+
for (const directory of resultDirectories) {
|
|
109
|
+
await allureReport.readDirectory(directory);
|
|
119
110
|
}
|
|
120
111
|
await allureReport.done();
|
|
121
|
-
const allTrs = await allureReport.store.allTestResults({
|
|
112
|
+
const allTrs = await allureReport.store.allTestResults({ includeRetries: false });
|
|
122
113
|
const validationResults = await allureReport.validate({
|
|
123
114
|
trs: allTrs,
|
|
124
115
|
knownIssues,
|
|
@@ -142,5 +133,13 @@ QualityGateCommand.usage = Command.Usage({
|
|
|
142
133
|
"quality-gate ./allure-results --config custom-config.js",
|
|
143
134
|
"Validate the test results using a custom configuration file",
|
|
144
135
|
],
|
|
136
|
+
[
|
|
137
|
+
"quality-gate ./packages/*/allure-results",
|
|
138
|
+
"Validate the test results in all Allure result directories matching the pattern",
|
|
139
|
+
],
|
|
140
|
+
[
|
|
141
|
+
"quality-gate ./packages/foo/allure-results ./packages/bar/allure-results",
|
|
142
|
+
"Validate the test results in two Allure result directories",
|
|
143
|
+
],
|
|
145
144
|
],
|
|
146
145
|
});
|
package/dist/commands/slack.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Command } from "clipanion";
|
|
|
2
2
|
export declare class SlackCommand extends Command {
|
|
3
3
|
static paths: string[][];
|
|
4
4
|
static usage: import("clipanion").Usage;
|
|
5
|
-
resultsDir: string;
|
|
5
|
+
resultsDir: string[];
|
|
6
6
|
config: string | undefined;
|
|
7
7
|
cwd: string | undefined;
|
|
8
8
|
token: string;
|
package/dist/commands/slack.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import * as console from "node:console";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
2
|
import { realpath } from "node:fs/promises";
|
|
4
3
|
import process, { exit } from "node:process";
|
|
5
4
|
import { AllureReport, readConfig } from "@allurereport/core";
|
|
6
5
|
import SlackPlugin from "@allurereport/plugin-slack";
|
|
7
6
|
import { Command, Option } from "clipanion";
|
|
8
7
|
import { red } from "yoctocolors";
|
|
8
|
+
import { findAllureResultDirectories } from "../utils/fileSystem.js";
|
|
9
9
|
export class SlackCommand extends Command {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
|
-
this.resultsDir = Option.
|
|
12
|
+
this.resultsDir = Option.Rest({
|
|
13
|
+
name: "Patterns to match test results directories in the current working directory (default: ./**/allure-results)",
|
|
14
|
+
});
|
|
13
15
|
this.config = Option.String("--config,-c", {
|
|
14
16
|
description: "The path Allure config file",
|
|
15
17
|
});
|
|
@@ -26,12 +28,13 @@ export class SlackCommand extends Command {
|
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
30
|
async execute() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
const cwd = await realpath(this.cwd ?? process.cwd());
|
|
32
|
+
const { resultDirectories, patterns } = await findAllureResultDirectories(cwd, this.resultsDir);
|
|
33
|
+
if (!resultDirectories.length) {
|
|
34
|
+
console.error(red(`No test results directories found matching pattern: ${patterns}`));
|
|
31
35
|
exit(1);
|
|
32
36
|
return;
|
|
33
37
|
}
|
|
34
|
-
const cwd = await realpath(this.cwd ?? process.cwd());
|
|
35
38
|
const before = new Date().getTime();
|
|
36
39
|
const defaultSlackOptions = {
|
|
37
40
|
token: this.token,
|
|
@@ -48,7 +51,9 @@ export class SlackCommand extends Command {
|
|
|
48
51
|
];
|
|
49
52
|
const allureReport = new AllureReport(config);
|
|
50
53
|
await allureReport.start();
|
|
51
|
-
|
|
54
|
+
for (const directory of resultDirectories) {
|
|
55
|
+
await allureReport.readDirectory(directory);
|
|
56
|
+
}
|
|
52
57
|
await allureReport.done();
|
|
53
58
|
const after = new Date().getTime();
|
|
54
59
|
console.log(`the report successfully generated (${after - before}ms)`);
|
|
@@ -64,5 +69,13 @@ SlackCommand.usage = Command.Usage({
|
|
|
64
69
|
"slack ./allure-results --token xoxb-token --channel C12345",
|
|
65
70
|
"Post test results from the ./allure-results directory to the specified Slack channel",
|
|
66
71
|
],
|
|
72
|
+
[
|
|
73
|
+
"slack ./packages/*/allure-results --token xoxb-token --channel C12345",
|
|
74
|
+
"Post test results from all Allure result directories matching the pattern",
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
"slack ./packages/foo/allure-results ./packages/bar/allure-results --token xoxb-token --channel C12345",
|
|
78
|
+
"Post test results from two Allure result directories",
|
|
79
|
+
],
|
|
67
80
|
],
|
|
68
81
|
});
|
|
@@ -2,7 +2,7 @@ import { Command } from "clipanion";
|
|
|
2
2
|
export declare class TestPlanCommand extends Command {
|
|
3
3
|
static paths: string[][];
|
|
4
4
|
static usage: import("clipanion").Usage;
|
|
5
|
-
resultsDir: string;
|
|
5
|
+
resultsDir: string[];
|
|
6
6
|
output: string | undefined;
|
|
7
7
|
execute(): Promise<void>;
|
|
8
8
|
}
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import * as console from "node:console";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
2
|
import { basename, dirname, resolve } from "node:path";
|
|
4
3
|
import { exit } from "node:process";
|
|
5
4
|
import { AllureReport, resolveConfig } from "@allurereport/core";
|
|
6
5
|
import { Command, Option } from "clipanion";
|
|
7
6
|
import { red } from "yoctocolors";
|
|
7
|
+
import { findAllureResultDirectories } from "../utils/fileSystem.js";
|
|
8
8
|
export class TestPlanCommand extends Command {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
|
-
this.resultsDir = Option.
|
|
11
|
+
this.resultsDir = Option.Rest({
|
|
12
|
+
name: "Patterns to match test results directories in the current working directory (default: ./**/allure-results)",
|
|
13
|
+
});
|
|
12
14
|
this.output = Option.String("--output,-o", {
|
|
13
15
|
description: "The output file name. Absolute paths are accepted as well",
|
|
14
16
|
});
|
|
15
17
|
}
|
|
16
18
|
async execute() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
const { resultDirectories, patterns } = await findAllureResultDirectories(process.cwd(), this.resultsDir);
|
|
20
|
+
if (!resultDirectories.length) {
|
|
21
|
+
console.error(red(`No test results directories found matching pattern: ${patterns}`));
|
|
19
22
|
exit(1);
|
|
20
23
|
return;
|
|
21
24
|
}
|
|
@@ -33,7 +36,9 @@ export class TestPlanCommand extends Command {
|
|
|
33
36
|
});
|
|
34
37
|
const allureReport = new AllureReport(config);
|
|
35
38
|
await allureReport.start();
|
|
36
|
-
|
|
39
|
+
for (const directory of resultDirectories) {
|
|
40
|
+
await allureReport.readDirectory(directory);
|
|
41
|
+
}
|
|
37
42
|
await allureReport.done();
|
|
38
43
|
const after = new Date().getTime();
|
|
39
44
|
console.log(`the report successfully generated (${after - before}ms)`);
|
|
@@ -49,5 +54,13 @@ TestPlanCommand.usage = Command.Usage({
|
|
|
49
54
|
"testplan ./allure-results --output custom-testplan.json",
|
|
50
55
|
"Generate a custom-testplan.json file from the ./allure-results directory",
|
|
51
56
|
],
|
|
57
|
+
[
|
|
58
|
+
"testplan ./packages/*/allure-results",
|
|
59
|
+
"Generate a testplan.json file from all Allure result directories matching the pattern",
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
"testplan ./packages/foo/allure-results ./packages/bar/allure-results",
|
|
63
|
+
"Generate a testplan.json file from two Allure result directories",
|
|
64
|
+
],
|
|
52
65
|
],
|
|
53
66
|
});
|
package/dist/commands/watch.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Command } from "clipanion";
|
|
|
2
2
|
export declare class WatchCommand extends Command {
|
|
3
3
|
static paths: string[][];
|
|
4
4
|
static usage: import("clipanion").Usage;
|
|
5
|
-
resultsDir: string;
|
|
5
|
+
resultsDir: string[];
|
|
6
6
|
config: string | undefined;
|
|
7
7
|
cwd: string | undefined;
|
|
8
8
|
output: string | undefined;
|
package/dist/commands/watch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as console from "node:console";
|
|
2
|
-
import {
|
|
2
|
+
import { realpath } from "node:fs/promises";
|
|
3
3
|
import { rm } from "node:fs/promises";
|
|
4
|
-
import { join
|
|
4
|
+
import { join } from "node:path";
|
|
5
5
|
import process, { exit } from "node:process";
|
|
6
6
|
import { AllureReport, isFileNotFoundError, readConfig } from "@allurereport/core";
|
|
7
7
|
import { newFilesInDirectoryWatcher } from "@allurereport/directory-watcher";
|
|
@@ -12,10 +12,13 @@ import { PathResultFile } from "@allurereport/reader-api";
|
|
|
12
12
|
import { serve } from "@allurereport/static-server";
|
|
13
13
|
import { Command, Option } from "clipanion";
|
|
14
14
|
import { red } from "yoctocolors";
|
|
15
|
+
import { findAllureResultDirectories } from "../utils/fileSystem.js";
|
|
15
16
|
export class WatchCommand extends Command {
|
|
16
17
|
constructor() {
|
|
17
18
|
super(...arguments);
|
|
18
|
-
this.resultsDir = Option.
|
|
19
|
+
this.resultsDir = Option.Rest({
|
|
20
|
+
name: "Patterns to match test results directories in the current working directory (default: ./**/allure-results)",
|
|
21
|
+
});
|
|
19
22
|
this.config = Option.String("--config,-c", {
|
|
20
23
|
description: "The path Allure config file",
|
|
21
24
|
});
|
|
@@ -36,8 +39,10 @@ export class WatchCommand extends Command {
|
|
|
36
39
|
});
|
|
37
40
|
}
|
|
38
41
|
async execute() {
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
const cwd = await realpath(this.cwd ?? process.cwd());
|
|
43
|
+
const { resultDirectories, patterns } = await findAllureResultDirectories(cwd, this.resultsDir);
|
|
44
|
+
if (!resultDirectories.length) {
|
|
45
|
+
console.error(red(`No test results directories found matching pattern: ${patterns}`));
|
|
41
46
|
exit(1);
|
|
42
47
|
return;
|
|
43
48
|
}
|
|
@@ -46,7 +51,7 @@ export class WatchCommand extends Command {
|
|
|
46
51
|
const after = new Date().getTime();
|
|
47
52
|
console.log(`exit code ${code} (${after - before}ms)`);
|
|
48
53
|
});
|
|
49
|
-
const config = await readConfig(
|
|
54
|
+
const config = await readConfig(cwd, this.config, {
|
|
50
55
|
output: this.output,
|
|
51
56
|
name: this.reportName,
|
|
52
57
|
open: this.open,
|
|
@@ -101,10 +106,13 @@ export class WatchCommand extends Command {
|
|
|
101
106
|
],
|
|
102
107
|
});
|
|
103
108
|
await allureReport.start();
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
const abortFunctions = [];
|
|
110
|
+
for (const directory of resultDirectories) {
|
|
111
|
+
const { abort } = newFilesInDirectoryWatcher(directory, async (path) => {
|
|
112
|
+
await allureReport.readResult(new PathResultFile(path));
|
|
113
|
+
});
|
|
114
|
+
abortFunctions.push(abort);
|
|
115
|
+
}
|
|
108
116
|
const pluginIdToOpen = config.plugins?.find((plugin) => !!plugin.options.open)?.id;
|
|
109
117
|
if (pluginIdToOpen) {
|
|
110
118
|
await server.open(join(server.url, pluginIdToOpen));
|
|
@@ -112,7 +120,9 @@ export class WatchCommand extends Command {
|
|
|
112
120
|
console.info("Press Ctrl+C to exit");
|
|
113
121
|
process.on("SIGINT", async () => {
|
|
114
122
|
console.log("");
|
|
115
|
-
|
|
123
|
+
for (const abort of abortFunctions) {
|
|
124
|
+
await abort();
|
|
125
|
+
}
|
|
116
126
|
await server.stop();
|
|
117
127
|
await allureReport.done();
|
|
118
128
|
process.exit(0);
|
|
@@ -129,5 +139,10 @@ WatchCommand.usage = Command.Usage({
|
|
|
129
139
|
"watch ./allure-results --port 8080",
|
|
130
140
|
"Watch for changes in the ./allure-results directory and serve the report on port 8080",
|
|
131
141
|
],
|
|
142
|
+
["watch ./packages/*/allure-results", "Watch for changes in all Allure result directories matching the pattern"],
|
|
143
|
+
[
|
|
144
|
+
"watch ./packages/foo/allure-results ./packages/bar/allure-results",
|
|
145
|
+
"Watch for changes in two Allure result directories",
|
|
146
|
+
],
|
|
132
147
|
],
|
|
133
148
|
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const findFilesByGlobs: (basePath: string, patterns: readonly string[]) => Promise<string[]>;
|
|
2
|
+
export declare const findDirectoriesByGlobs: (basePath: string, patterns: readonly string[]) => Promise<string[]>;
|
|
3
|
+
export declare const findAllureResultDirectories: (basePath: string, patterns: readonly string[]) => Promise<{
|
|
4
|
+
patterns: readonly string[];
|
|
5
|
+
resultDirectories: string[];
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { glob } from "glob";
|
|
2
|
+
export const findFilesByGlobs = async (basePath, patterns) => {
|
|
3
|
+
const files = [];
|
|
4
|
+
for (const pattern of patterns) {
|
|
5
|
+
const searchResults = await glob(pattern, {
|
|
6
|
+
nodir: true,
|
|
7
|
+
dot: true,
|
|
8
|
+
absolute: true,
|
|
9
|
+
windowsPathsNoEscape: true,
|
|
10
|
+
cwd: basePath,
|
|
11
|
+
});
|
|
12
|
+
files.push(...searchResults);
|
|
13
|
+
}
|
|
14
|
+
return files;
|
|
15
|
+
};
|
|
16
|
+
export const findDirectoriesByGlobs = async (basePath, patterns) => {
|
|
17
|
+
const directories = [];
|
|
18
|
+
for (const pattern of patterns) {
|
|
19
|
+
const searchResults = await glob(pattern, {
|
|
20
|
+
mark: true,
|
|
21
|
+
nodir: false,
|
|
22
|
+
absolute: true,
|
|
23
|
+
dot: true,
|
|
24
|
+
windowsPathsNoEscape: true,
|
|
25
|
+
cwd: basePath,
|
|
26
|
+
});
|
|
27
|
+
const matchedDirs = searchResults.filter((p) => /(\/|\\)$/.test(p));
|
|
28
|
+
directories.push(...matchedDirs);
|
|
29
|
+
}
|
|
30
|
+
return directories;
|
|
31
|
+
};
|
|
32
|
+
export const findAllureResultDirectories = async (basePath, patterns) => {
|
|
33
|
+
const resolvedPatterns = patterns.length ? patterns : ["./**/allure-results"];
|
|
34
|
+
const resultDirectories = await findDirectoriesByGlobs(basePath, resolvedPatterns);
|
|
35
|
+
return { patterns: resolvedPatterns, resultDirectories };
|
|
36
|
+
};
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "allure",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "Allure Commandline Tool",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -32,26 +32,26 @@
|
|
|
32
32
|
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@allurereport/charts-api": "3.
|
|
36
|
-
"@allurereport/ci": "3.
|
|
37
|
-
"@allurereport/core": "3.
|
|
38
|
-
"@allurereport/core-api": "3.
|
|
39
|
-
"@allurereport/directory-watcher": "3.
|
|
40
|
-
"@allurereport/plugin-agent": "3.
|
|
41
|
-
"@allurereport/plugin-allure2": "3.
|
|
42
|
-
"@allurereport/plugin-api": "3.
|
|
43
|
-
"@allurereport/plugin-awesome": "3.
|
|
44
|
-
"@allurereport/plugin-classic": "3.
|
|
45
|
-
"@allurereport/plugin-csv": "3.
|
|
46
|
-
"@allurereport/plugin-dashboard": "3.
|
|
47
|
-
"@allurereport/plugin-jira": "3.
|
|
48
|
-
"@allurereport/plugin-log": "3.
|
|
49
|
-
"@allurereport/plugin-progress": "3.
|
|
50
|
-
"@allurereport/plugin-server-reload": "3.
|
|
51
|
-
"@allurereport/plugin-slack": "3.
|
|
52
|
-
"@allurereport/reader-api": "3.
|
|
53
|
-
"@allurereport/service": "3.
|
|
54
|
-
"@allurereport/static-server": "3.
|
|
35
|
+
"@allurereport/charts-api": "3.9.0",
|
|
36
|
+
"@allurereport/ci": "3.9.0",
|
|
37
|
+
"@allurereport/core": "3.9.0",
|
|
38
|
+
"@allurereport/core-api": "3.9.0",
|
|
39
|
+
"@allurereport/directory-watcher": "3.9.0",
|
|
40
|
+
"@allurereport/plugin-agent": "3.9.0",
|
|
41
|
+
"@allurereport/plugin-allure2": "3.9.0",
|
|
42
|
+
"@allurereport/plugin-api": "3.9.0",
|
|
43
|
+
"@allurereport/plugin-awesome": "3.9.0",
|
|
44
|
+
"@allurereport/plugin-classic": "3.9.0",
|
|
45
|
+
"@allurereport/plugin-csv": "3.9.0",
|
|
46
|
+
"@allurereport/plugin-dashboard": "3.9.0",
|
|
47
|
+
"@allurereport/plugin-jira": "3.9.0",
|
|
48
|
+
"@allurereport/plugin-log": "3.9.0",
|
|
49
|
+
"@allurereport/plugin-progress": "3.9.0",
|
|
50
|
+
"@allurereport/plugin-server-reload": "3.9.0",
|
|
51
|
+
"@allurereport/plugin-slack": "3.9.0",
|
|
52
|
+
"@allurereport/reader-api": "3.9.0",
|
|
53
|
+
"@allurereport/service": "3.9.0",
|
|
54
|
+
"@allurereport/static-server": "3.9.0",
|
|
55
55
|
"adm-zip": "^0.5.16",
|
|
56
56
|
"clipanion": "^4.0.0-rc.4",
|
|
57
57
|
"glob": "^13.0.6",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"@types/prompts": "^2",
|
|
68
68
|
"@vitest/runner": "^2.1.9",
|
|
69
69
|
"@vitest/snapshot": "^2.1.9",
|
|
70
|
+
"allure-js-commons": "^3.3.3",
|
|
70
71
|
"allure-vitest": "^3.3.3",
|
|
71
72
|
"rimraf": "^6.0.1",
|
|
72
73
|
"typescript": "^5.6.3",
|