allure 3.0.0-beta.0 → 3.0.0-beta.10
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/README.md +148 -16
- package/dist/commands/allure2.d.ts +11 -0
- package/dist/commands/allure2.js +70 -0
- package/dist/commands/awesome.d.ts +1 -0
- package/dist/commands/awesome.js +15 -4
- package/dist/commands/classic.js +3 -2
- package/dist/commands/csv.js +3 -2
- package/dist/commands/generate.js +2 -2
- package/dist/commands/history.js +1 -1
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.js +1 -0
- package/dist/commands/knownIssue.js +7 -3
- package/dist/commands/log.js +3 -2
- package/dist/commands/open.d.ts +1 -0
- package/dist/commands/open.js +10 -4
- package/dist/commands/qualityGate.d.ts +1 -0
- package/dist/commands/qualityGate.js +11 -5
- package/dist/commands/run.js +13 -12
- package/dist/commands/slack.js +3 -2
- package/dist/commands/testplan.js +3 -2
- package/dist/commands/watch.js +10 -10
- package/dist/index.d.ts +1 -2
- package/dist/index.js +3 -3
- package/dist/utils/commands.d.ts +1 -1
- package/dist/utils/commands.js +4 -2
- package/dist/utils/process.d.ts +1 -1
- package/dist/utils/terminal.d.ts +1 -1
- package/dist/utils/terminal.js +1 -1
- package/package.json +17 -11
package/README.md
CHANGED
|
@@ -1,33 +1,165 @@
|
|
|
1
|
-
# Allure
|
|
2
|
-
|
|
1
|
+
# Allure 3
|
|
2
|
+
|
|
3
|
+
**Allure 3** is the next evolution of the Allure reporting framework, rebuilt from the ground up with a new architecture and expanded capabilities. Unlike its predecessor, **Allure 2**, this version is developed in **TypeScript** and introduces a modular plugin system for greater flexibility. A key addition is the **Awesome** plugin, which delivers an enhanced UI for better report visualization.
|
|
4
|
+
|
|
5
|
+
> 🚧 **Allure 3 is currently in beta and under active development.**
|
|
6
|
+
> Although not production-ready, we encourage users to install, explore, and share feedback with the development team.
|
|
7
|
+
|
|
8
|
+
The **Allure 3 CLI** provides a comprehensive suite of commands designed to streamline the generation, serving, and management of test reports.
|
|
9
|
+
|
|
3
10
|
[<img src="https://allurereport.org/public/img/allure-report.svg" height="85px" alt="Allure Report logo" align="right" />](https://allurereport.org "Allure Report")
|
|
4
11
|
|
|
5
12
|
- Learn more about Allure Report at https://allurereport.org
|
|
6
13
|
- 📚 [Documentation](https://allurereport.org/docs/) – discover official documentation for Allure Report
|
|
7
14
|
- ❓ [Questions and Support](https://github.com/orgs/allure-framework/discussions/categories/questions-support) – get help from the team and community
|
|
8
|
-
- 📢 [Official
|
|
15
|
+
- 📢 [Official annoucements](https://github.com/orgs/allure-framework/discussions/categories/announcements) – be in touch with the latest updates
|
|
9
16
|
- 💬 [General Discussion ](https://github.com/orgs/allure-framework/discussions/categories/general-discussion) – engage in casual conversations, share insights and ideas with the community
|
|
10
17
|
|
|
11
|
-
|
|
18
|
+
## Key Features
|
|
19
|
+
|
|
20
|
+
Allure 3 introduces several notable improvements. The framework has been entirely rewritten in **TypeScript**, making it more extensible and easier to maintain. Its **plugin system** allows you to customize and extend reporting functionality to fit your specific needs. Configuration has been simplified with a **single file** managing all report settings, making it more convenient to handle multiple reports.
|
|
21
|
+
|
|
22
|
+
One of the standout features is **real-time reporting**, which lets you view live updates during test execution using the `watch` command. The report interface itself has been redesigned to enhance usability and clarity. Moreover, Allure 3 maintains **compatibility with the entire Allure ecosystem**, supporting all major test frameworks.
|
|
23
|
+
|
|
24
|
+
> 🚧 Please note that **official CI/CD integrations and IDE plugins are not yet available** for Allure 3.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
To install Allure 3 globally, you can use [`npm`](https://docs.npmjs.com/downloading-and-installing-packages-globally). Simply run:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install -g allure
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
However, we recommend using `npx` for running Allure commands without needing a global installation:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx allure run -- <test_command>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
This approach ensures you always use the latest version without managing global dependencies.
|
|
12
41
|
|
|
13
|
-
##
|
|
42
|
+
## Commands
|
|
14
43
|
|
|
15
|
-
|
|
44
|
+
### Running Tests and Generating Reports
|
|
16
45
|
|
|
17
|
-
|
|
46
|
+
Running tests and generating a report with Allure 3 is straightforward. Using the `run` command, you can execute your test suite and automatically generate a report:
|
|
18
47
|
|
|
19
|
-
|
|
48
|
+
```bash
|
|
49
|
+
npx allure run -- <test_command>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
For example, if you're using `npm` as your test runner, the command would be:
|
|
20
53
|
|
|
21
|
-
```
|
|
22
|
-
npm
|
|
23
|
-
yarn add allure
|
|
24
|
-
pnpm add allure
|
|
54
|
+
```bash
|
|
55
|
+
npx allure run -- npm test
|
|
25
56
|
```
|
|
26
57
|
|
|
27
|
-
|
|
58
|
+
To successfully generate a report, ensure that your test setup outputs results into an `allure-results` directory, which is automatically detected by Allure 3. This directory can be placed at any nested level within your project (e.g., `out/tests/allure-results`), provided it retains the correct name.
|
|
59
|
+
|
|
60
|
+
After the tests complete, the report is generated automatically. Existing results from previous runs are ignored, as Allure 3 focuses solely on new data to ensure accurate and up-to-date reporting.
|
|
61
|
+
|
|
62
|
+
### Generating Reports Manually
|
|
28
63
|
|
|
29
|
-
|
|
64
|
+
If you already have test results and wish to generate a report manually, use the `generate` command:
|
|
30
65
|
|
|
31
|
-
```
|
|
32
|
-
allure
|
|
66
|
+
```bash
|
|
67
|
+
npx allure generate <resultsDir>
|
|
33
68
|
```
|
|
69
|
+
|
|
70
|
+
By default, this command produces an **Allure 3 Awesome** report. You can customize output settings, such as the destination directory, through the configuration file. If you prefer a **Classic** or **Allure 2-style** report, or need to disable certain plugins, these adjustments can also be made via configuration.
|
|
71
|
+
|
|
72
|
+
### Viewing Reports
|
|
73
|
+
|
|
74
|
+
To view a previously generated report locally, the `open` command serves it in your default browser:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npx allure open <reportDir>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If you’ve defined the output directory in your configuration file, specifying `<reportDir>` is optional. By default, Allure 3 looks for a directory named `allure-report`. To open the Awesome report directly, point to the nested directory:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npx allure open allure-report/awesome
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Real-time Report Monitoring
|
|
87
|
+
|
|
88
|
+
When you need to monitor test execution live, the `watch` command provides dynamic report updates. It continuously monitors the specified results directory for changes and refreshes the report automatically:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npx allure watch <allureResultsDir>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This command is ideal for iterative development and debugging, allowing you to see immediate feedback as you modify and rerun tests. The browser tab updates seamlessly whenever new results are detected.
|
|
95
|
+
|
|
96
|
+
### Command-line Options
|
|
97
|
+
|
|
98
|
+
The Allure CLI includes several helpful global options. Use `--help` to explore available commands or get detailed usage information for a specific command:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npx allure run --help
|
|
102
|
+
npx allure watch --help
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
To check your installed version of Allure 3, use:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npx allure --version
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
## Configuration
|
|
113
|
+
|
|
114
|
+
Allure 3 uses an `allurerc.mjs` configuration file to manage report settings, including the report name, output directory, and plugin options.
|
|
115
|
+
|
|
116
|
+
> 💡 **Tip:** We recommend using the **Awesome** plugin for the best experience.
|
|
117
|
+
> Support for Classic and Allure 2-style reports is currently experimental.
|
|
118
|
+
|
|
119
|
+
### Example Configuration File
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
import { defineConfig } from "allure";
|
|
123
|
+
|
|
124
|
+
export default defineConfig({
|
|
125
|
+
name: "Allure Report Example",
|
|
126
|
+
output: "./out/allure-report",
|
|
127
|
+
plugins: {
|
|
128
|
+
awesome: {
|
|
129
|
+
options: {
|
|
130
|
+
singleFile: true,
|
|
131
|
+
reportLanguage: "en",
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
In this example, the generated report is named *Allure Report Example* and saved to the `./out/allure-report` directory. The **Awesome** plugin is enabled with options to produce a single-file HTML report in English.
|
|
139
|
+
|
|
140
|
+
### Configuration Options
|
|
141
|
+
|
|
142
|
+
The configuration file allows you to fine-tune report generation. Key options include:
|
|
143
|
+
|
|
144
|
+
- **`name`**: Specifies the report’s display name.
|
|
145
|
+
- **`output`**: Defines the directory where the report will be saved.
|
|
146
|
+
- **`plugins`**: Enables and configures plugins, with each supporting various options.
|
|
147
|
+
|
|
148
|
+
### Awesome Plugin Options
|
|
149
|
+
|
|
150
|
+
The **Awesome** plugin offers several customizable options:
|
|
151
|
+
|
|
152
|
+
- **`singleFile`** *(boolean)*: If set to `true`, generates the report as a single standalone HTML file.
|
|
153
|
+
- **`reportName`** *(string)*: Overrides the default report name.
|
|
154
|
+
- **`open`** *(boolean)*: Automatically opens the report after generation if enabled.
|
|
155
|
+
- **`reportLanguage`** *(string)*: Sets the UI language of the report. Supported languages include:
|
|
156
|
+
|
|
157
|
+
`az`, `br`, `de`, `en`, `es`, `fr`, `he`, `ja`, `kr`, `nl`, `pl`, `ru`, `sv`, `tr`, `zh`.
|
|
158
|
+
|
|
159
|
+
For example, setting `"reportLanguage": "fr"` will render the report interface in French.
|
|
160
|
+
|
|
161
|
+
## Final Notes
|
|
162
|
+
|
|
163
|
+
Allure 3 represents a significant step forward in test reporting, offering improved performance, flexibility, and an enhanced user interface. While it remains in beta, the framework is stable enough for exploration and feedback. We encourage you to experiment with the **Awesome** plugin and share your insights to help us refine the experience.
|
|
164
|
+
|
|
165
|
+
Stay updated with the latest features, and don’t hesitate to contribute or report issues. Together, we can make Allure 3 the best it can be!
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type ClassicCommandOptions = {
|
|
2
|
+
output?: string;
|
|
3
|
+
reportName?: string;
|
|
4
|
+
reportLanguage?: string;
|
|
5
|
+
singleFile?: boolean;
|
|
6
|
+
historyPath?: string;
|
|
7
|
+
knownIssues?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const ClassicLegacyCommandAction: (resultsDir: string, options: ClassicCommandOptions) => Promise<void>;
|
|
10
|
+
export declare const ClassicLegacyCommand: (cli: import("cac").CAC) => void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { AllureReport, resolveConfig } from "@allurereport/core";
|
|
2
|
+
import * as console from "node:console";
|
|
3
|
+
import { createCommand } from "../utils/commands.js";
|
|
4
|
+
export const ClassicLegacyCommandAction = async (resultsDir, options) => {
|
|
5
|
+
const before = new Date().getTime();
|
|
6
|
+
const { output, reportName: name, historyPath, knownIssues: knownIssuesPath, ...rest } = options;
|
|
7
|
+
const config = await resolveConfig({
|
|
8
|
+
output,
|
|
9
|
+
name,
|
|
10
|
+
historyPath,
|
|
11
|
+
knownIssuesPath,
|
|
12
|
+
plugins: {
|
|
13
|
+
"@allurereport/plugin-allure2": {
|
|
14
|
+
options: rest,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const allureReport = new AllureReport(config);
|
|
19
|
+
await allureReport.start();
|
|
20
|
+
await allureReport.readDirectory(resultsDir);
|
|
21
|
+
await allureReport.done();
|
|
22
|
+
const after = new Date().getTime();
|
|
23
|
+
console.log(`the report successfully generated (${after - before}ms)`);
|
|
24
|
+
};
|
|
25
|
+
export const ClassicLegacyCommand = createCommand({
|
|
26
|
+
name: "allure2 <resultsDir>",
|
|
27
|
+
description: "Generates Allure Classic report based on provided Allure Results",
|
|
28
|
+
options: [
|
|
29
|
+
[
|
|
30
|
+
"--output, -o <file>",
|
|
31
|
+
{
|
|
32
|
+
description: "The output directory name. Absolute paths are accepted as well",
|
|
33
|
+
default: "allure-report",
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
"--report-name, --name <string>",
|
|
38
|
+
{
|
|
39
|
+
description: "The report name",
|
|
40
|
+
default: "Allure Report",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
"--report-language, --lang <string>",
|
|
45
|
+
{
|
|
46
|
+
description: "Default language of the report (default: OS language)",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
"--single-file",
|
|
51
|
+
{
|
|
52
|
+
description: "Generate single file report",
|
|
53
|
+
default: false,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
"--history-path, -h <file>",
|
|
58
|
+
{
|
|
59
|
+
description: "The path to history file",
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
"--known-issues <file>",
|
|
64
|
+
{
|
|
65
|
+
description: "Path to the known issues file. Updates the file and quarantines failed tests when specified",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
],
|
|
69
|
+
action: ClassicLegacyCommandAction,
|
|
70
|
+
});
|
|
@@ -6,6 +6,7 @@ type AwesomeCommandOptions = {
|
|
|
6
6
|
singleFile?: boolean;
|
|
7
7
|
historyPath?: string;
|
|
8
8
|
knownIssues?: string;
|
|
9
|
+
groupBy?: string;
|
|
9
10
|
};
|
|
10
11
|
export declare const AwesomeCommandAction: (resultsDir: string, options: AwesomeCommandOptions) => Promise<void>;
|
|
11
12
|
export declare const AwesomeCommand: (cli: import("cac").CAC) => void;
|
package/dist/commands/awesome.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import { AllureReport, resolveConfig } from "@
|
|
1
|
+
import { AllureReport, resolveConfig } from "@allurereport/core";
|
|
2
|
+
import * as console from "node:console";
|
|
2
3
|
import { createCommand } from "../utils/commands.js";
|
|
3
4
|
export const AwesomeCommandAction = async (resultsDir, options) => {
|
|
4
5
|
const before = new Date().getTime();
|
|
5
|
-
const { output, reportName: name, historyPath, knownIssues: knownIssuesPath, ...rest } = options;
|
|
6
|
+
const { output, reportName: name, historyPath, knownIssues: knownIssuesPath, groupBy, ...rest } = options;
|
|
6
7
|
const config = await resolveConfig({
|
|
7
8
|
output,
|
|
8
9
|
name,
|
|
9
10
|
historyPath,
|
|
10
11
|
knownIssuesPath,
|
|
11
12
|
plugins: {
|
|
12
|
-
"@
|
|
13
|
-
options:
|
|
13
|
+
"@allurereport/plugin-awesome": {
|
|
14
|
+
options: {
|
|
15
|
+
...rest,
|
|
16
|
+
groupBy: groupBy?.split(","),
|
|
17
|
+
},
|
|
14
18
|
},
|
|
15
19
|
},
|
|
16
20
|
});
|
|
@@ -76,6 +80,13 @@ export const AwesomeCommand = createCommand({
|
|
|
76
80
|
description: "Path to the known issues file. Updates the file and quarantines failed tests when specified",
|
|
77
81
|
},
|
|
78
82
|
],
|
|
83
|
+
[
|
|
84
|
+
"--group-by, -g <string>",
|
|
85
|
+
{
|
|
86
|
+
description: "Group test results by labels. The labels should be separated by commas",
|
|
87
|
+
default: "parentSuite,suite,subSuite",
|
|
88
|
+
},
|
|
89
|
+
],
|
|
79
90
|
],
|
|
80
91
|
action: AwesomeCommandAction,
|
|
81
92
|
});
|
package/dist/commands/classic.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AllureReport, resolveConfig } from "@
|
|
1
|
+
import { AllureReport, resolveConfig } from "@allurereport/core";
|
|
2
|
+
import * as console from "node:console";
|
|
2
3
|
import { createCommand } from "../utils/commands.js";
|
|
3
4
|
export const ClassicCommandAction = async (resultsDir, options) => {
|
|
4
5
|
const before = new Date().getTime();
|
|
@@ -9,7 +10,7 @@ export const ClassicCommandAction = async (resultsDir, options) => {
|
|
|
9
10
|
historyPath,
|
|
10
11
|
knownIssuesPath,
|
|
11
12
|
plugins: {
|
|
12
|
-
"@
|
|
13
|
+
"@allurereport/plugin-classic": {
|
|
13
14
|
options: rest,
|
|
14
15
|
},
|
|
15
16
|
},
|
package/dist/commands/csv.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { AllureReport, resolveConfig } from "@
|
|
1
|
+
import { AllureReport, resolveConfig } from "@allurereport/core";
|
|
2
|
+
import * as console from "node:console";
|
|
2
3
|
import { createCommand } from "../utils/commands.js";
|
|
3
4
|
export const CsvCommandAction = async (resultsDir, options) => {
|
|
4
5
|
const before = new Date().getTime();
|
|
5
6
|
const config = await resolveConfig({
|
|
6
7
|
plugins: {
|
|
7
|
-
"@
|
|
8
|
+
"@allurereport/plugin-csv": {
|
|
8
9
|
options,
|
|
9
10
|
},
|
|
10
11
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AllureReport,
|
|
1
|
+
import { AllureReport, readConfig } from "@allurereport/core";
|
|
2
2
|
import { createCommand } from "../utils/commands.js";
|
|
3
3
|
export const GenerateCommandAction = async (resultsDir, options) => {
|
|
4
4
|
const { config: configPath, output, cwd, reportName } = options;
|
|
5
|
-
const config = await
|
|
5
|
+
const config = await readConfig(cwd, configPath, { name: reportName, output });
|
|
6
6
|
const allureReport = new AllureReport(config);
|
|
7
7
|
await allureReport.start();
|
|
8
8
|
await allureReport.readDirectory(resultsDir);
|
package/dist/commands/history.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AllureReport, resolveConfig } from "@
|
|
1
|
+
import { AllureReport, resolveConfig } from "@allurereport/core";
|
|
2
2
|
import { createCommand } from "../utils/commands.js";
|
|
3
3
|
export const HistoryCommandAction = async (resultsDir, options) => {
|
|
4
4
|
const config = await resolveConfig({
|
package/dist/commands/index.d.ts
CHANGED
package/dist/commands/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { AllureReport,
|
|
1
|
+
import { AllureReport, resolveConfig, writeKnownIssues } from "@allurereport/core";
|
|
2
2
|
import console from "node:console";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { createCommand } from "../utils/commands.js";
|
|
5
5
|
export const KnownIssueCommandAction = async (resultsDir, options) => {
|
|
6
6
|
const { output = "known-issues.json" } = options;
|
|
7
|
-
const config = await
|
|
7
|
+
const config = await resolveConfig({
|
|
8
|
+
plugins: {},
|
|
9
|
+
});
|
|
8
10
|
const allureReport = new AllureReport(config);
|
|
9
|
-
|
|
11
|
+
await allureReport.start();
|
|
10
12
|
await allureReport.readDirectory(resultsDir);
|
|
13
|
+
await allureReport.done();
|
|
14
|
+
const targetPath = resolve(output);
|
|
11
15
|
await writeKnownIssues(allureReport.store, output);
|
|
12
16
|
console.log(`writing known-issues.json to ${targetPath}`);
|
|
13
17
|
};
|
package/dist/commands/log.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { AllureReport, resolveConfig } from "@
|
|
1
|
+
import { AllureReport, resolveConfig } from "@allurereport/core";
|
|
2
|
+
import * as console from "node:console";
|
|
2
3
|
import { createCommand } from "../utils/commands.js";
|
|
3
4
|
export const LogCommandAction = async (resultsDir, options) => {
|
|
4
5
|
const before = new Date().getTime();
|
|
5
6
|
const config = await resolveConfig({
|
|
6
7
|
plugins: {
|
|
7
|
-
"@
|
|
8
|
+
"@allurereport/plugin-log": {
|
|
8
9
|
options,
|
|
9
10
|
},
|
|
10
11
|
},
|
package/dist/commands/open.d.ts
CHANGED
package/dist/commands/open.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { serve } from "@
|
|
1
|
+
import { readConfig } from "@allurereport/core";
|
|
2
|
+
import { serve } from "@allurereport/static-server";
|
|
3
3
|
import { createCommand } from "../utils/commands.js";
|
|
4
4
|
export const OpenCommandAction = async (reportDir, options) => {
|
|
5
|
-
const { config: configPath, port, live } = options;
|
|
6
|
-
const config = await
|
|
5
|
+
const { config: configPath, port, live, cwd } = options;
|
|
6
|
+
const config = await readConfig(cwd, configPath, { output: reportDir });
|
|
7
7
|
await serve({
|
|
8
8
|
port: port,
|
|
9
9
|
servePath: config.output,
|
|
@@ -34,6 +34,12 @@ export const OpenCommand = createCommand({
|
|
|
34
34
|
default: false,
|
|
35
35
|
},
|
|
36
36
|
],
|
|
37
|
+
[
|
|
38
|
+
"--cwd <cwd>",
|
|
39
|
+
{
|
|
40
|
+
description: "The working directory for the command to run (default: current working directory)",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
37
43
|
],
|
|
38
44
|
action: OpenCommandAction,
|
|
39
45
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AllureReport,
|
|
1
|
+
import { AllureReport, readConfig } from "@allurereport/core";
|
|
2
2
|
import console from "node:console";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { bold, red } from "yoctocolors";
|
|
5
5
|
import { createCommand } from "../utils/commands.js";
|
|
6
6
|
export const QualityGateCommandAction = async (resultsDir, options) => {
|
|
7
|
-
const cwd = options
|
|
8
|
-
const fullConfig = await
|
|
7
|
+
const { cwd, config: configPath } = options;
|
|
8
|
+
const fullConfig = await readConfig(cwd, configPath);
|
|
9
9
|
const allureReport = new AllureReport(fullConfig);
|
|
10
10
|
await allureReport.start();
|
|
11
11
|
await allureReport.readDirectory(resultsDir);
|
|
@@ -28,17 +28,23 @@ export const QualityGateCommandAction = async (resultsDir, options) => {
|
|
|
28
28
|
}
|
|
29
29
|
console.error(red(`⨯ ${bold(`${result.rule}${scope}`)}: expected ${result.expected}, actual ${result.actual}`));
|
|
30
30
|
}
|
|
31
|
-
console.error(red(
|
|
31
|
+
console.error(red("\nThe process has been exited with code 1"));
|
|
32
32
|
process.exit(allureReport.exitCode);
|
|
33
33
|
};
|
|
34
34
|
export const QualityGateCommand = createCommand({
|
|
35
35
|
name: "quality-gate <resultsDir>",
|
|
36
36
|
description: "Returns status code 1 if there any test failure above specified success rate",
|
|
37
37
|
options: [
|
|
38
|
+
[
|
|
39
|
+
"--config, -c <file>",
|
|
40
|
+
{
|
|
41
|
+
description: "The path Allure config file",
|
|
42
|
+
},
|
|
43
|
+
],
|
|
38
44
|
[
|
|
39
45
|
"--cwd <cwd>",
|
|
40
46
|
{
|
|
41
|
-
description: "The working directory for the command to run (
|
|
47
|
+
description: "The working directory for the command to run (Default: current working directory)",
|
|
42
48
|
},
|
|
43
49
|
],
|
|
44
50
|
],
|
package/dist/commands/run.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AllureReport, isFileNotFoundError,
|
|
2
|
-
import { createTestPlan } from "@
|
|
3
|
-
import { allureResultsDirectoriesWatcher, delayedFileProcessingWatcher, newFilesInDirectoryWatcher, } from "@
|
|
4
|
-
import
|
|
5
|
-
import { PathResultFile } from "@
|
|
1
|
+
import { AllureReport, isFileNotFoundError, readConfig } from "@allurereport/core";
|
|
2
|
+
import { createTestPlan } from "@allurereport/core-api";
|
|
3
|
+
import { allureResultsDirectoriesWatcher, delayedFileProcessingWatcher, newFilesInDirectoryWatcher, } from "@allurereport/directory-watcher";
|
|
4
|
+
import Awesome from "@allurereport/plugin-awesome";
|
|
5
|
+
import { PathResultFile } from "@allurereport/reader-api";
|
|
6
6
|
import * as console from "node:console";
|
|
7
7
|
import { mkdtemp, realpath, rm, writeFile } from "node:fs/promises";
|
|
8
8
|
import { tmpdir } from "node:os";
|
|
@@ -54,6 +54,7 @@ const runTests = async (allureReport, cwd, command, commandArgs, environment, si
|
|
|
54
54
|
allureResultsWatchers.delete(ar);
|
|
55
55
|
}
|
|
56
56
|
await processWatcher.abort();
|
|
57
|
+
return code;
|
|
57
58
|
};
|
|
58
59
|
export const RunCommandAction = async (options) => {
|
|
59
60
|
const args = options["--"];
|
|
@@ -61,16 +62,16 @@ export const RunCommandAction = async (options) => {
|
|
|
61
62
|
throw new Error("expecting command to be specified after --, e.g. allure run -- npm run test");
|
|
62
63
|
}
|
|
63
64
|
const before = new Date().getTime();
|
|
64
|
-
process.on("exit", (
|
|
65
|
+
process.on("exit", (exitCode) => {
|
|
65
66
|
const after = new Date().getTime();
|
|
66
|
-
console.log(`exit code ${
|
|
67
|
+
console.log(`exit code ${exitCode} (${after - before}ms)`);
|
|
67
68
|
});
|
|
68
69
|
const command = args[0];
|
|
69
70
|
const commandArgs = args.slice(1);
|
|
70
71
|
const cwd = await realpath(options.cwd ?? process.cwd());
|
|
71
72
|
console.log(`${command} ${commandArgs.join(" ")}`);
|
|
72
73
|
const { config: configPath, output, reportName, rerun: maxRerun = 0, silent = false } = options;
|
|
73
|
-
const config = await
|
|
74
|
+
const config = await readConfig(cwd, configPath, { output, name: reportName });
|
|
74
75
|
try {
|
|
75
76
|
await rm(config.output, { recursive: true });
|
|
76
77
|
}
|
|
@@ -90,7 +91,7 @@ export const RunCommandAction = async (options) => {
|
|
|
90
91
|
id: "awesome",
|
|
91
92
|
enabled: true,
|
|
92
93
|
options: {},
|
|
93
|
-
plugin: new
|
|
94
|
+
plugin: new Awesome({
|
|
94
95
|
reportName: config.name,
|
|
95
96
|
}),
|
|
96
97
|
},
|
|
@@ -98,7 +99,7 @@ export const RunCommandAction = async (options) => {
|
|
|
98
99
|
],
|
|
99
100
|
});
|
|
100
101
|
await allureReport.start();
|
|
101
|
-
await runTests(allureReport, cwd, command, commandArgs, {}, silent);
|
|
102
|
+
let code = await runTests(allureReport, cwd, command, commandArgs, {}, silent);
|
|
102
103
|
for (let rerun = 0; rerun < maxRerun; rerun++) {
|
|
103
104
|
const failed = await allureReport.store.failedTestResults();
|
|
104
105
|
if (failed.length === 0) {
|
|
@@ -111,7 +112,7 @@ export const RunCommandAction = async (options) => {
|
|
|
111
112
|
const tmpDir = await mkdtemp(join(tmpdir(), "allure-run-"));
|
|
112
113
|
const testPlanPath = resolve(tmpDir, `${rerun}-testplan.json`);
|
|
113
114
|
await writeFile(testPlanPath, JSON.stringify(testPlan));
|
|
114
|
-
await runTests(allureReport, cwd, command, commandArgs, {
|
|
115
|
+
code = await runTests(allureReport, cwd, command, commandArgs, {
|
|
115
116
|
ALLURE_TESTPLAN_PATH: testPlanPath,
|
|
116
117
|
ALLURE_RERUN: `${rerun}`,
|
|
117
118
|
}, silent);
|
|
@@ -120,7 +121,7 @@ export const RunCommandAction = async (options) => {
|
|
|
120
121
|
}
|
|
121
122
|
await allureReport.done();
|
|
122
123
|
await allureReport.validate();
|
|
123
|
-
process.exit(allureReport.exitCode);
|
|
124
|
+
process.exit(code ?? allureReport.exitCode);
|
|
124
125
|
};
|
|
125
126
|
export const RunCommand = createCommand({
|
|
126
127
|
name: "run",
|
package/dist/commands/slack.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { AllureReport, resolveConfig } from "@
|
|
1
|
+
import { AllureReport, resolveConfig } from "@allurereport/core";
|
|
2
|
+
import * as console from "node:console";
|
|
2
3
|
import { createCommand } from "../utils/commands.js";
|
|
3
4
|
export const SlackCommandAction = async (resultsDir, options) => {
|
|
4
5
|
const before = new Date().getTime();
|
|
5
6
|
const config = await resolveConfig({
|
|
6
7
|
plugins: {
|
|
7
|
-
"@
|
|
8
|
+
"@allurereport/plugin-slack": {
|
|
8
9
|
options,
|
|
9
10
|
},
|
|
10
11
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AllureReport, resolveConfig } from "@
|
|
1
|
+
import { AllureReport, resolveConfig } from "@allurereport/core";
|
|
2
|
+
import * as console from "node:console";
|
|
2
3
|
import { basename, dirname, resolve } from "node:path";
|
|
3
4
|
import { createCommand } from "../utils/commands.js";
|
|
4
5
|
export const TestPlanCommandAction = async (resultsDir, options) => {
|
|
@@ -9,7 +10,7 @@ export const TestPlanCommandAction = async (resultsDir, options) => {
|
|
|
9
10
|
const config = await resolveConfig({
|
|
10
11
|
output: output,
|
|
11
12
|
plugins: {
|
|
12
|
-
"@
|
|
13
|
+
"@allurereport/plugin-testplan": {
|
|
13
14
|
options: { fileName },
|
|
14
15
|
},
|
|
15
16
|
},
|
package/dist/commands/watch.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AllureReport, isFileNotFoundError,
|
|
2
|
-
import { newFilesInDirectoryWatcher } from "@
|
|
3
|
-
import
|
|
4
|
-
import ProgressPlugin from "@
|
|
5
|
-
import ServerReloadPlugin from "@
|
|
6
|
-
import { PathResultFile } from "@
|
|
7
|
-
import { serve } from "@
|
|
1
|
+
import { AllureReport, isFileNotFoundError, readConfig } from "@allurereport/core";
|
|
2
|
+
import { newFilesInDirectoryWatcher } from "@allurereport/directory-watcher";
|
|
3
|
+
import Awesome from "@allurereport/plugin-awesome";
|
|
4
|
+
import ProgressPlugin from "@allurereport/plugin-progress";
|
|
5
|
+
import ServerReloadPlugin from "@allurereport/plugin-server-reload";
|
|
6
|
+
import { PathResultFile } from "@allurereport/reader-api";
|
|
7
|
+
import { serve } from "@allurereport/static-server";
|
|
8
8
|
import * as console from "node:console";
|
|
9
9
|
import { rm } from "node:fs/promises";
|
|
10
10
|
import { join, resolve } from "node:path";
|
|
@@ -17,7 +17,7 @@ export const WatchCommandAction = async (resultsDir, options) => {
|
|
|
17
17
|
console.log(`exit code ${code} (${after - before}ms)`);
|
|
18
18
|
});
|
|
19
19
|
const { config: configPath, output, cwd, reportName } = options;
|
|
20
|
-
const config = await
|
|
20
|
+
const config = await readConfig(cwd, configPath, { output, name: reportName });
|
|
21
21
|
try {
|
|
22
22
|
await rm(config.output, { recursive: true });
|
|
23
23
|
}
|
|
@@ -28,7 +28,7 @@ export const WatchCommandAction = async (resultsDir, options) => {
|
|
|
28
28
|
}
|
|
29
29
|
const server = await serve({
|
|
30
30
|
servePath: config.output,
|
|
31
|
-
port: options.port ? parseInt(options.port) : undefined,
|
|
31
|
+
port: options.port ? parseInt(options.port, 10) : undefined,
|
|
32
32
|
live: false,
|
|
33
33
|
open: false,
|
|
34
34
|
});
|
|
@@ -43,7 +43,7 @@ export const WatchCommandAction = async (resultsDir, options) => {
|
|
|
43
43
|
id: "awesome",
|
|
44
44
|
enabled: true,
|
|
45
45
|
options: {},
|
|
46
|
-
plugin: new
|
|
46
|
+
plugin: new Awesome({
|
|
47
47
|
reportName: config.name,
|
|
48
48
|
}),
|
|
49
49
|
},
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { defineConfig };
|
|
1
|
+
export { defineConfig } from "@allurereport/plugin-api";
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineConfig } from "@allure/core";
|
|
2
1
|
import { cac } from "cac";
|
|
3
2
|
import console from "node:console";
|
|
4
3
|
import { readFileSync } from "node:fs";
|
|
5
4
|
import { cwd } from "node:process";
|
|
6
|
-
import { ClassicCommand,
|
|
5
|
+
import { AwesomeCommand, ClassicCommand, ClassicLegacyCommand, CsvCommand, GenerateCommand, HistoryCommand, KnownIssueCommand, LogCommand, OpenCommand, QualityGateCommand, RunCommand, SlackCommand, TestPlanCommand, WatchCommand, } from "./commands/index.js";
|
|
7
6
|
const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
8
7
|
const cli = cac(pkg.name).usage(pkg.description).help().version(pkg.version);
|
|
9
8
|
const commands = [
|
|
10
9
|
ClassicCommand,
|
|
10
|
+
ClassicLegacyCommand,
|
|
11
11
|
AwesomeCommand,
|
|
12
12
|
CsvCommand,
|
|
13
13
|
GenerateCommand,
|
|
@@ -30,4 +30,4 @@ cli.on("command:*", () => {
|
|
|
30
30
|
});
|
|
31
31
|
console.log(cwd());
|
|
32
32
|
cli.parse();
|
|
33
|
-
export { defineConfig };
|
|
33
|
+
export { defineConfig } from "@allurereport/plugin-api";
|
package/dist/utils/commands.d.ts
CHANGED
package/dist/utils/commands.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export const createCommand = (payload) => {
|
|
2
|
-
if (!payload.name)
|
|
2
|
+
if (!payload.name) {
|
|
3
3
|
throw new Error("Command name is not provided!");
|
|
4
|
-
|
|
4
|
+
}
|
|
5
|
+
if (!payload.action) {
|
|
5
6
|
throw new Error("Command action is not provided!");
|
|
7
|
+
}
|
|
6
8
|
return (cli) => {
|
|
7
9
|
const command = cli.command(payload.name, payload.description);
|
|
8
10
|
payload?.options?.forEach(([name, parameters]) => {
|
package/dist/utils/process.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ChildProcess } from "node:child_process";
|
|
1
|
+
import type { ChildProcess } from "node:child_process";
|
|
2
2
|
export declare const runProcess: (command: string, commandArgs: string[], cwd: string | undefined, environment: Record<string, string>, silent?: boolean) => ChildProcess;
|
|
3
3
|
export declare const terminationOf: (testProcess: ChildProcess) => Promise<number | null>;
|
package/dist/utils/terminal.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TestResult, TestStatus } from "@
|
|
1
|
+
import type { TestResult, TestStatus } from "@allurereport/core-api";
|
|
2
2
|
export declare const status2color: (status: TestStatus) => import("yoctocolors").Format;
|
|
3
3
|
export declare const logTests: (testResults: TestResult[]) => void;
|
package/dist/utils/terminal.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "allure",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.10",
|
|
4
4
|
"description": "Allure Commandline Tool",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -24,19 +24,24 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "run clean && tsc --project ./tsconfig.json",
|
|
26
26
|
"clean": "rimraf ./dist",
|
|
27
|
+
"eslint": "eslint ./src/**/*.{js,jsx,ts,tsx}",
|
|
28
|
+
"eslint:format": "eslint --fix ./src/**/*.{js,jsx,ts,tsx}",
|
|
27
29
|
"start": "node ./cli.js",
|
|
28
30
|
"test": "vitest run"
|
|
29
31
|
},
|
|
30
32
|
"dependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
33
|
+
"@allurereport/core": "3.0.0-beta.10",
|
|
34
|
+
"@allurereport/core-api": "3.0.0-beta.10",
|
|
35
|
+
"@allurereport/directory-watcher": "3.0.0-beta.10",
|
|
36
|
+
"@allurereport/plugin-allure2": "3.0.0-beta.10",
|
|
37
|
+
"@allurereport/plugin-api": "3.0.0-beta.10",
|
|
38
|
+
"@allurereport/plugin-awesome": "3.0.0-beta.10",
|
|
39
|
+
"@allurereport/plugin-classic": "3.0.0-beta.10",
|
|
40
|
+
"@allurereport/plugin-progress": "3.0.0-beta.10",
|
|
41
|
+
"@allurereport/plugin-server-reload": "3.0.0-beta.10",
|
|
42
|
+
"@allurereport/plugin-slack": "3.0.0-beta.10",
|
|
43
|
+
"@allurereport/reader-api": "3.0.0-beta.10",
|
|
44
|
+
"@allurereport/static-server": "3.0.0-beta.10",
|
|
40
45
|
"cac": "^6.7.14",
|
|
41
46
|
"lodash.omit": "^4.5.0",
|
|
42
47
|
"yoctocolors": "^2.1.1"
|
|
@@ -49,7 +54,8 @@
|
|
|
49
54
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
50
55
|
"@typescript-eslint/parser": "^8.0.0",
|
|
51
56
|
"@vitest/runner": "^2.1.8",
|
|
52
|
-
"
|
|
57
|
+
"@vitest/snapshot": "^2.1.8",
|
|
58
|
+
"allure-vitest": "^3.0.9",
|
|
53
59
|
"eslint": "^8.57.0",
|
|
54
60
|
"eslint-config-prettier": "^9.1.0",
|
|
55
61
|
"eslint-plugin-import": "^2.29.1",
|