allure 3.0.0-beta.15 → 3.0.0-beta.16
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 +2 -0
- package/dist/commands/allure2.js +29 -10
- package/dist/commands/awesome.d.ts +2 -0
- package/dist/commands/awesome.js +30 -13
- package/dist/commands/classic.d.ts +2 -0
- package/dist/commands/classic.js +27 -8
- package/dist/commands/csv.d.ts +2 -0
- package/dist/commands/csv.js +30 -7
- package/dist/commands/dashboard.d.ts +2 -0
- package/dist/commands/dashboard.js +28 -8
- package/dist/commands/generate.js +18 -4
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/index.js +4 -0
- package/dist/commands/log.d.ts +2 -0
- package/dist/commands/log.js +28 -7
- package/dist/commands/login.d.ts +7 -0
- package/dist/commands/login.js +47 -0
- package/dist/commands/logout.d.ts +7 -0
- package/dist/commands/logout.js +47 -0
- package/dist/commands/projects/create.d.ts +7 -0
- package/dist/commands/projects/create.js +79 -0
- package/dist/commands/projects/delete.d.ts +7 -0
- package/dist/commands/projects/delete.js +74 -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 +7 -0
- package/dist/commands/projects/list.js +75 -0
- package/dist/commands/run.d.ts +1 -1
- package/dist/commands/run.js +54 -40
- package/dist/commands/slack.d.ts +2 -0
- package/dist/commands/slack.js +27 -7
- package/dist/commands/whoami.d.ts +7 -0
- package/dist/commands/whoami.js +51 -0
- package/dist/index.js +9 -2
- 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 +22 -17
package/dist/commands/allure2.js
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import { AllureReport,
|
|
1
|
+
import { AllureReport, enforcePlugin, readConfig } from "@allurereport/core";
|
|
2
|
+
import Allure2Plugin from "@allurereport/plugin-allure2";
|
|
2
3
|
import * as console from "node:console";
|
|
4
|
+
import { realpath } from "node:fs/promises";
|
|
5
|
+
import process from "node:process";
|
|
3
6
|
import { createCommand } from "../utils/commands.js";
|
|
4
7
|
export const ClassicLegacyCommandAction = async (resultsDir, options) => {
|
|
8
|
+
const cwd = await realpath(options.cwd ?? process.cwd());
|
|
5
9
|
const before = new Date().getTime();
|
|
6
|
-
const { output, reportName
|
|
7
|
-
const
|
|
10
|
+
const { config: configPath, output, reportName, historyPath, knownIssues: knownIssuesPath, ...rest } = options;
|
|
11
|
+
const defaultAllure2Options = {
|
|
12
|
+
...rest,
|
|
13
|
+
};
|
|
14
|
+
const config = enforcePlugin(await readConfig(cwd, configPath, {
|
|
8
15
|
output,
|
|
9
|
-
name,
|
|
10
|
-
historyPath,
|
|
16
|
+
name: reportName,
|
|
11
17
|
knownIssuesPath,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
historyPath,
|
|
19
|
+
}), {
|
|
20
|
+
id: "allure2",
|
|
21
|
+
enabled: true,
|
|
22
|
+
options: defaultAllure2Options,
|
|
23
|
+
plugin: new Allure2Plugin(defaultAllure2Options),
|
|
17
24
|
});
|
|
18
25
|
const allureReport = new AllureReport(config);
|
|
19
26
|
await allureReport.start();
|
|
@@ -26,6 +33,18 @@ export const ClassicLegacyCommand = createCommand({
|
|
|
26
33
|
name: "allure2 <resultsDir>",
|
|
27
34
|
description: "Generates Allure Classic report based on provided Allure Results",
|
|
28
35
|
options: [
|
|
36
|
+
[
|
|
37
|
+
"--config, -c <file>",
|
|
38
|
+
{
|
|
39
|
+
description: "The path Allure config file",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
[
|
|
43
|
+
"--cwd <cwd>",
|
|
44
|
+
{
|
|
45
|
+
description: "The working directory for the command to run (Default: current working directory)",
|
|
46
|
+
},
|
|
47
|
+
],
|
|
29
48
|
[
|
|
30
49
|
"--output, -o <file>",
|
|
31
50
|
{
|
package/dist/commands/awesome.js
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
import { AllureReport,
|
|
1
|
+
import { AllureReport, enforcePlugin, readConfig } from "@allurereport/core";
|
|
2
|
+
import { default as AwesomePlugin } from "@allurereport/plugin-awesome";
|
|
2
3
|
import * as console from "node:console";
|
|
4
|
+
import { realpath } from "node:fs/promises";
|
|
5
|
+
import process from "node:process";
|
|
3
6
|
import { createCommand } from "../utils/commands.js";
|
|
4
7
|
export const AwesomeCommandAction = async (resultsDir, options) => {
|
|
8
|
+
const cwd = await realpath(options.cwd ?? process.cwd());
|
|
5
9
|
const before = new Date().getTime();
|
|
6
|
-
const { output, reportName
|
|
7
|
-
const
|
|
10
|
+
const { config: configPath, output, reportName, historyPath, knownIssues: knownIssuesPath, groupBy, ...rest } = options;
|
|
11
|
+
const defaultAwesomeOptions = {
|
|
12
|
+
...rest,
|
|
13
|
+
groupBy: groupBy?.split(","),
|
|
14
|
+
};
|
|
15
|
+
const config = enforcePlugin(await readConfig(cwd, configPath, {
|
|
8
16
|
output,
|
|
9
|
-
name,
|
|
10
|
-
historyPath,
|
|
17
|
+
name: reportName,
|
|
11
18
|
knownIssuesPath,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
},
|
|
19
|
+
historyPath,
|
|
20
|
+
}), {
|
|
21
|
+
id: "awesome",
|
|
22
|
+
enabled: true,
|
|
23
|
+
options: defaultAwesomeOptions,
|
|
24
|
+
plugin: new AwesomePlugin(defaultAwesomeOptions),
|
|
20
25
|
});
|
|
21
26
|
const allureReport = new AllureReport(config);
|
|
22
27
|
await allureReport.start();
|
|
@@ -29,6 +34,18 @@ export const AwesomeCommand = createCommand({
|
|
|
29
34
|
name: "awesome <resultsDir>",
|
|
30
35
|
description: "Generates Allure Awesome report based on provided Allure Results",
|
|
31
36
|
options: [
|
|
37
|
+
[
|
|
38
|
+
"--config, -c <file>",
|
|
39
|
+
{
|
|
40
|
+
description: "The path Allure config file",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
"--cwd <cwd>",
|
|
45
|
+
{
|
|
46
|
+
description: "The working directory for the command to run (Default: current working directory)",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
32
49
|
[
|
|
33
50
|
"--output, -o <file>",
|
|
34
51
|
{
|
package/dist/commands/classic.js
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import { AllureReport,
|
|
1
|
+
import { AllureReport, enforcePlugin, readConfig } from "@allurereport/core";
|
|
2
|
+
import ClassicPlugin from "@allurereport/plugin-classic";
|
|
2
3
|
import * as console from "node:console";
|
|
4
|
+
import { realpath } from "node:fs/promises";
|
|
5
|
+
import process from "node:process";
|
|
3
6
|
import { createCommand } from "../utils/commands.js";
|
|
4
7
|
export const ClassicCommandAction = async (resultsDir, options) => {
|
|
8
|
+
const cwd = await realpath(options.cwd ?? process.cwd());
|
|
5
9
|
const before = new Date().getTime();
|
|
6
|
-
const { output, reportName: name, historyPath, knownIssues: knownIssuesPath, ...rest } = options;
|
|
7
|
-
const
|
|
10
|
+
const { config: configPath, output, reportName: name, historyPath, knownIssues: knownIssuesPath, ...rest } = options;
|
|
11
|
+
const defaultClassicOptions = {
|
|
12
|
+
...rest,
|
|
13
|
+
};
|
|
14
|
+
const config = enforcePlugin(await readConfig(cwd, configPath, {
|
|
8
15
|
output,
|
|
9
16
|
name,
|
|
10
17
|
historyPath,
|
|
11
18
|
knownIssuesPath,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
}), {
|
|
20
|
+
id: "classic",
|
|
21
|
+
enabled: true,
|
|
22
|
+
options: defaultClassicOptions,
|
|
23
|
+
plugin: new ClassicPlugin(defaultClassicOptions),
|
|
17
24
|
});
|
|
18
25
|
const allureReport = new AllureReport(config);
|
|
19
26
|
await allureReport.start();
|
|
@@ -26,6 +33,18 @@ export const ClassicCommand = createCommand({
|
|
|
26
33
|
name: "classic <resultsDir>",
|
|
27
34
|
description: "Generates Allure Classic report based on provided Allure Results",
|
|
28
35
|
options: [
|
|
36
|
+
[
|
|
37
|
+
"--config, -c <file>",
|
|
38
|
+
{
|
|
39
|
+
description: "The path Allure config file",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
[
|
|
43
|
+
"--cwd <cwd>",
|
|
44
|
+
{
|
|
45
|
+
description: "The working directory for the command to run (Default: current working directory)",
|
|
46
|
+
},
|
|
47
|
+
],
|
|
29
48
|
[
|
|
30
49
|
"--output, -o <file>",
|
|
31
50
|
{
|
package/dist/commands/csv.d.ts
CHANGED
package/dist/commands/csv.js
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import { AllureReport,
|
|
1
|
+
import { AllureReport, enforcePlugin, readConfig } from "@allurereport/core";
|
|
2
|
+
import CsvPlugin from "@allurereport/plugin-csv";
|
|
2
3
|
import * as console from "node:console";
|
|
4
|
+
import { realpath } from "node:fs/promises";
|
|
5
|
+
import process from "node:process";
|
|
3
6
|
import { createCommand } from "../utils/commands.js";
|
|
4
7
|
export const CsvCommandAction = async (resultsDir, options) => {
|
|
8
|
+
const cwd = await realpath(options.cwd ?? process.cwd());
|
|
5
9
|
const before = new Date().getTime();
|
|
6
|
-
const config =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const { config: configPath, output, knownIssues: knownIssuesPath, separator, disableHeaders } = options;
|
|
11
|
+
const defaultCsvOptions = {
|
|
12
|
+
separator,
|
|
13
|
+
disableHeaders,
|
|
14
|
+
};
|
|
15
|
+
const config = enforcePlugin(await readConfig(cwd, configPath, {
|
|
16
|
+
output,
|
|
17
|
+
knownIssuesPath,
|
|
18
|
+
}), {
|
|
19
|
+
id: "csv",
|
|
20
|
+
enabled: true,
|
|
21
|
+
options: defaultCsvOptions,
|
|
22
|
+
plugin: new CsvPlugin(defaultCsvOptions),
|
|
12
23
|
});
|
|
13
24
|
const allureReport = new AllureReport(config);
|
|
14
25
|
await allureReport.start();
|
|
@@ -21,6 +32,18 @@ export const CsvCommand = createCommand({
|
|
|
21
32
|
name: "csv <resultsDir>",
|
|
22
33
|
description: "Generates CSV report based on provided Allure Results",
|
|
23
34
|
options: [
|
|
35
|
+
[
|
|
36
|
+
"--config, -c <file>",
|
|
37
|
+
{
|
|
38
|
+
description: "The path Allure config file",
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
"--cwd <cwd>",
|
|
43
|
+
{
|
|
44
|
+
description: "The working directory for the command to run (Default: current working directory)",
|
|
45
|
+
},
|
|
46
|
+
],
|
|
24
47
|
[
|
|
25
48
|
"--output, -o <file>",
|
|
26
49
|
{
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import { AllureReport,
|
|
1
|
+
import { AllureReport, enforcePlugin, readConfig } from "@allurereport/core";
|
|
2
|
+
import DashboardPlugin from "@allurereport/plugin-dashboard";
|
|
2
3
|
import * as console from "node:console";
|
|
4
|
+
import { realpath } from "node:fs/promises";
|
|
5
|
+
import process from "node:process";
|
|
3
6
|
import { createCommand } from "../utils/commands.js";
|
|
4
7
|
export const DashboardCommandAction = async (resultsDir, options) => {
|
|
8
|
+
const cwd = await realpath(options.cwd ?? process.cwd());
|
|
5
9
|
const before = new Date().getTime();
|
|
6
|
-
const { output, reportName: name, ...rest } = options;
|
|
7
|
-
const
|
|
10
|
+
const { config: configPath, output, reportName: name, ...rest } = options;
|
|
11
|
+
const defaultDashboardOptions = {
|
|
12
|
+
...rest,
|
|
13
|
+
reportLanguage: rest.reportLanguage ?? "en",
|
|
14
|
+
};
|
|
15
|
+
const config = enforcePlugin(await readConfig(cwd, configPath, {
|
|
8
16
|
output,
|
|
9
17
|
name,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
}), {
|
|
19
|
+
id: "dashboard",
|
|
20
|
+
enabled: true,
|
|
21
|
+
options: defaultDashboardOptions,
|
|
22
|
+
plugin: new DashboardPlugin(defaultDashboardOptions),
|
|
15
23
|
});
|
|
16
24
|
const allureReport = new AllureReport(config);
|
|
17
25
|
await allureReport.start();
|
|
@@ -24,6 +32,18 @@ export const DashboardCommand = createCommand({
|
|
|
24
32
|
name: "dashboard <resultsDir>",
|
|
25
33
|
description: "Generates Allure Dashboard report based on provided Allure Results",
|
|
26
34
|
options: [
|
|
35
|
+
[
|
|
36
|
+
"--config, -c <file>",
|
|
37
|
+
{
|
|
38
|
+
description: "The path Allure config file",
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
"--cwd <cwd>",
|
|
43
|
+
{
|
|
44
|
+
description: "The working directory for the command to run (Default: current working directory)",
|
|
45
|
+
},
|
|
46
|
+
],
|
|
27
47
|
[
|
|
28
48
|
"--output, -o <file>",
|
|
29
49
|
{
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import { AllureReport, readConfig } from "@allurereport/core";
|
|
2
|
+
import { KnownError } from "@allurereport/service";
|
|
3
|
+
import { red } from "yoctocolors";
|
|
2
4
|
import { createCommand } from "../utils/commands.js";
|
|
5
|
+
import { logError } from "../utils/logs.js";
|
|
3
6
|
export const GenerateCommandAction = async (resultsDir, options) => {
|
|
4
7
|
const { config: configPath, output, cwd, reportName } = options;
|
|
5
8
|
const config = await readConfig(cwd, configPath, { name: reportName, output });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
try {
|
|
10
|
+
const allureReport = new AllureReport(config);
|
|
11
|
+
await allureReport.start();
|
|
12
|
+
await allureReport.readDirectory(resultsDir);
|
|
13
|
+
await allureReport.done();
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
if (error instanceof KnownError) {
|
|
17
|
+
console.error(red(error.message));
|
|
18
|
+
process.exit(1);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
await logError("Failed to generate report due to unexpected error", error);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
10
24
|
};
|
|
11
25
|
export const GenerateCommand = createCommand({
|
|
12
26
|
name: "generate <resultsDir>",
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -15,3 +15,7 @@ export * from "./qualityGate.js";
|
|
|
15
15
|
export * from "./log.js";
|
|
16
16
|
export * from "./generate.js";
|
|
17
17
|
export * from "./dashboard.js";
|
|
18
|
+
export * from "./login.js";
|
|
19
|
+
export * from "./logout.js";
|
|
20
|
+
export * from "./whoami.js";
|
|
21
|
+
export * from "./projects/index.js";
|
package/dist/commands/index.js
CHANGED
|
@@ -15,3 +15,7 @@ export * from "./qualityGate.js";
|
|
|
15
15
|
export * from "./log.js";
|
|
16
16
|
export * from "./generate.js";
|
|
17
17
|
export * from "./dashboard.js";
|
|
18
|
+
export * from "./login.js";
|
|
19
|
+
export * from "./logout.js";
|
|
20
|
+
export * from "./whoami.js";
|
|
21
|
+
export * from "./projects/index.js";
|
package/dist/commands/log.d.ts
CHANGED
package/dist/commands/log.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import { AllureReport,
|
|
1
|
+
import { AllureReport, enforcePlugin, readConfig } from "@allurereport/core";
|
|
2
|
+
import LogPlugin from "@allurereport/plugin-log";
|
|
2
3
|
import * as console from "node:console";
|
|
4
|
+
import { realpath } from "node:fs/promises";
|
|
5
|
+
import process from "node:process";
|
|
3
6
|
import { createCommand } from "../utils/commands.js";
|
|
4
7
|
export const LogCommandAction = async (resultsDir, options) => {
|
|
8
|
+
const cwd = await realpath(options.cwd ?? process.cwd());
|
|
5
9
|
const before = new Date().getTime();
|
|
6
|
-
const config =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const { config: configPath, allSteps, withTrace, groupBy } = options;
|
|
11
|
+
const defaultLogOptions = {
|
|
12
|
+
allSteps,
|
|
13
|
+
withTrace,
|
|
14
|
+
groupBy,
|
|
15
|
+
};
|
|
16
|
+
const config = enforcePlugin(await readConfig(cwd, configPath), {
|
|
17
|
+
id: "log",
|
|
18
|
+
enabled: true,
|
|
19
|
+
options: defaultLogOptions,
|
|
20
|
+
plugin: new LogPlugin(defaultLogOptions),
|
|
12
21
|
});
|
|
13
22
|
const allureReport = new AllureReport(config);
|
|
14
23
|
await allureReport.start();
|
|
@@ -21,6 +30,18 @@ export const LogCommand = createCommand({
|
|
|
21
30
|
name: "log <resultsDir>",
|
|
22
31
|
description: "Prints Allure Results to the console",
|
|
23
32
|
options: [
|
|
33
|
+
[
|
|
34
|
+
"--config, -c <file>",
|
|
35
|
+
{
|
|
36
|
+
description: "The path Allure config file",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
"--cwd <cwd>",
|
|
41
|
+
{
|
|
42
|
+
description: "The working directory for the command to run (Default: current working directory)",
|
|
43
|
+
},
|
|
44
|
+
],
|
|
24
45
|
[
|
|
25
46
|
"--group-by <label>",
|
|
26
47
|
{
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { readConfig } from "@allurereport/core";
|
|
2
|
+
import { AllureServiceClient, KnownError } from "@allurereport/service";
|
|
3
|
+
import { green, red } from "yoctocolors";
|
|
4
|
+
import { createCommand } from "../utils/commands.js";
|
|
5
|
+
import { logError } from "../utils/logs.js";
|
|
6
|
+
export const LoginCommandAction = async (options) => {
|
|
7
|
+
const { config: configPath, cwd } = options ?? {};
|
|
8
|
+
const config = await readConfig(cwd, configPath);
|
|
9
|
+
if (!config?.allureService?.url) {
|
|
10
|
+
console.error(red("No Allure Service URL is provided. Please provide it in the `allureService.url` field in the `allure.config.js` file"));
|
|
11
|
+
process.exit(1);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const serviceClient = new AllureServiceClient(config.allureService);
|
|
15
|
+
try {
|
|
16
|
+
await serviceClient.login();
|
|
17
|
+
console.info(green("Logged in"));
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
if (error instanceof KnownError) {
|
|
21
|
+
console.error(red(error.message));
|
|
22
|
+
process.exit(1);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
await logError("Failed to login due to unexpected error", error);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export const LoginCommand = createCommand({
|
|
30
|
+
name: "login",
|
|
31
|
+
description: "Logs in to the Allure Service",
|
|
32
|
+
options: [
|
|
33
|
+
[
|
|
34
|
+
"--config, -c <file>",
|
|
35
|
+
{
|
|
36
|
+
description: "The path Allure config file",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
"--cwd <cwd>",
|
|
41
|
+
{
|
|
42
|
+
description: "The working directory for the command to run (default: current working directory)",
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
],
|
|
46
|
+
action: LoginCommandAction,
|
|
47
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { readConfig } from "@allurereport/core";
|
|
2
|
+
import { AllureServiceClient, KnownError } from "@allurereport/service";
|
|
3
|
+
import { green, red } from "yoctocolors";
|
|
4
|
+
import { createCommand } from "../utils/commands.js";
|
|
5
|
+
import { logError } from "../utils/logs.js";
|
|
6
|
+
export const LogoutCommandAction = async (options) => {
|
|
7
|
+
const { config: configPath, cwd } = options ?? {};
|
|
8
|
+
const config = await readConfig(cwd, configPath);
|
|
9
|
+
if (!config?.allureService?.url) {
|
|
10
|
+
console.error(red("No Allure Service URL is provided. Please provide it in the `allureService.url` field in the `allure.config.js` file"));
|
|
11
|
+
process.exit(1);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const serviceClient = new AllureServiceClient(config.allureService);
|
|
15
|
+
try {
|
|
16
|
+
await serviceClient.logout();
|
|
17
|
+
console.info(green("Logged out"));
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
if (error instanceof KnownError) {
|
|
21
|
+
console.error(red(error.message));
|
|
22
|
+
process.exit(1);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
await logError("Failed to logout due to unexpected error", error);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export const LogoutCommand = createCommand({
|
|
30
|
+
name: "logout",
|
|
31
|
+
description: "Logs out from the Allure Service",
|
|
32
|
+
options: [
|
|
33
|
+
[
|
|
34
|
+
"--config, -c <file>",
|
|
35
|
+
{
|
|
36
|
+
description: "The path Allure config file",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
"--cwd <cwd>",
|
|
41
|
+
{
|
|
42
|
+
description: "The working directory for the command to run (default: current working directory)",
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
],
|
|
46
|
+
action: LogoutCommandAction,
|
|
47
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type CommandOptions = {
|
|
2
|
+
config?: string;
|
|
3
|
+
cwd?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const ProjectsCreateCommandAction: (projectName?: string, options?: CommandOptions) => Promise<void>;
|
|
6
|
+
export declare const ProjectsCreateCommand: (cli: import("cac").CAC) => void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { getGitRepoName, readConfig } from "@allurereport/core";
|
|
2
|
+
import { AllureServiceClient, KnownError } from "@allurereport/service";
|
|
3
|
+
import prompts from "prompts";
|
|
4
|
+
import { green, red } from "yoctocolors";
|
|
5
|
+
import { createCommand } from "../../utils/commands.js";
|
|
6
|
+
import { logError } from "../../utils/logs.js";
|
|
7
|
+
export const ProjectsCreateCommandAction = async (projectName, options) => {
|
|
8
|
+
const { config: configPath, cwd } = options ?? {};
|
|
9
|
+
const config = await readConfig(cwd, configPath);
|
|
10
|
+
if (!config?.allureService?.url) {
|
|
11
|
+
console.error(red("No Allure Service URL is provided. Please provide it in the `allureService.url` field in the `allure.config.js` file"));
|
|
12
|
+
process.exit(1);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const serviceClient = new AllureServiceClient(config.allureService);
|
|
16
|
+
let name = projectName;
|
|
17
|
+
if (!name) {
|
|
18
|
+
try {
|
|
19
|
+
name = await getGitRepoName();
|
|
20
|
+
}
|
|
21
|
+
catch (ignored) { }
|
|
22
|
+
}
|
|
23
|
+
if (!name) {
|
|
24
|
+
const res = await prompts({
|
|
25
|
+
type: "text",
|
|
26
|
+
name: "name",
|
|
27
|
+
message: "Enter project name",
|
|
28
|
+
});
|
|
29
|
+
name = res?.name;
|
|
30
|
+
}
|
|
31
|
+
if (!name) {
|
|
32
|
+
console.error(red("No project name provided!"));
|
|
33
|
+
process.exit(1);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const project = await serviceClient.createProject({
|
|
38
|
+
name,
|
|
39
|
+
});
|
|
40
|
+
const lines = [
|
|
41
|
+
`The "${green(project.name)}" has been created. Insert following code into your Allure Config file, to enable Allure Service features for the project:`,
|
|
42
|
+
"",
|
|
43
|
+
green("{"),
|
|
44
|
+
green(" allureService: {"),
|
|
45
|
+
green(` project: "${project.name}"`),
|
|
46
|
+
green(" }"),
|
|
47
|
+
green("}"),
|
|
48
|
+
];
|
|
49
|
+
console.info(lines.join("\n"));
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (error instanceof KnownError) {
|
|
53
|
+
console.error(red(error.message));
|
|
54
|
+
process.exit(1);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
await logError("Failed to create project due to unexpected error", error);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
export const ProjectsCreateCommand = createCommand({
|
|
62
|
+
name: "project-create [name]",
|
|
63
|
+
description: "",
|
|
64
|
+
options: [
|
|
65
|
+
[
|
|
66
|
+
"--config, -c <file>",
|
|
67
|
+
{
|
|
68
|
+
description: "The path Allure config file",
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
"--cwd <cwd>",
|
|
73
|
+
{
|
|
74
|
+
description: "The working directory for the command to run (default: current working directory)",
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
],
|
|
78
|
+
action: ProjectsCreateCommandAction,
|
|
79
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type CommandOptions = {
|
|
2
|
+
force?: boolean;
|
|
3
|
+
config?: string;
|
|
4
|
+
cwd?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const ProjectsDeleteCommandAction: (projectName?: string, options?: CommandOptions) => Promise<void>;
|
|
7
|
+
export declare const ProjectsDeleteCommand: (cli: import("cac").CAC) => void;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { readConfig } from "@allurereport/core";
|
|
2
|
+
import { AllureServiceClient, KnownError } from "@allurereport/service";
|
|
3
|
+
import prompts from "prompts";
|
|
4
|
+
import { green, red } from "yoctocolors";
|
|
5
|
+
import { createCommand } from "../../utils/commands.js";
|
|
6
|
+
import { logError } from "../../utils/logs.js";
|
|
7
|
+
export const ProjectsDeleteCommandAction = async (projectName, options) => {
|
|
8
|
+
const { force = false } = options ?? {};
|
|
9
|
+
const { config: configPath, cwd } = options ?? {};
|
|
10
|
+
const config = await readConfig(cwd, configPath);
|
|
11
|
+
if (!config?.allureService?.url) {
|
|
12
|
+
console.error(red("No Allure Service URL is provided. Please provide it in the `allureService.url` field in the `allure.config.js` file"));
|
|
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}"?`,
|
|
27
|
+
});
|
|
28
|
+
if (!res.value) {
|
|
29
|
+
process.exit(0);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
await serviceClient.deleteProject({
|
|
35
|
+
name: projectName,
|
|
36
|
+
});
|
|
37
|
+
console.info(green("Project has been deleted"));
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error instanceof KnownError) {
|
|
41
|
+
console.error(red(error.message));
|
|
42
|
+
process.exit(1);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
await logError("Failed to delete project due to unexpected error", error);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
export const ProjectsDeleteCommand = createCommand({
|
|
50
|
+
name: "project-delete <name>",
|
|
51
|
+
description: "",
|
|
52
|
+
options: [
|
|
53
|
+
[
|
|
54
|
+
"--force",
|
|
55
|
+
{
|
|
56
|
+
description: "Delete project with no confirmation",
|
|
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
|
+
],
|
|
72
|
+
],
|
|
73
|
+
action: ProjectsDeleteCommandAction,
|
|
74
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { readConfig } from "@allurereport/core";
|
|
2
|
+
import { AllureServiceClient, KnownError } from "@allurereport/service";
|
|
3
|
+
import prompts from "prompts";
|
|
4
|
+
import { green, red, yellow } from "yoctocolors";
|
|
5
|
+
import { createCommand } from "../../utils/commands.js";
|
|
6
|
+
import { logError } from "../../utils/logs.js";
|
|
7
|
+
export const ProjectsListCommandAction = async (options) => {
|
|
8
|
+
const { config: configPath, cwd } = options ?? {};
|
|
9
|
+
const config = await readConfig(cwd, configPath);
|
|
10
|
+
if (!config?.allureService?.url) {
|
|
11
|
+
console.error(red("No Allure Service URL is provided. Please provide it in the `allureService.url` field in the `allure.config.js` file"));
|
|
12
|
+
process.exit(1);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const serviceClient = new AllureServiceClient(config.allureService);
|
|
16
|
+
try {
|
|
17
|
+
const projects = await serviceClient.projects();
|
|
18
|
+
if (projects.length === 0) {
|
|
19
|
+
console.info(yellow("No projects found. Create a new one with `allure project-create` command"));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const res = await prompts({
|
|
23
|
+
type: "select",
|
|
24
|
+
name: "project",
|
|
25
|
+
message: "Select a project",
|
|
26
|
+
choices: projects.map((project) => ({
|
|
27
|
+
title: project.name,
|
|
28
|
+
value: project.name,
|
|
29
|
+
})),
|
|
30
|
+
});
|
|
31
|
+
if (!res?.project) {
|
|
32
|
+
console.error(red("No project selected"));
|
|
33
|
+
process.exit(1);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const lines = [
|
|
37
|
+
"Insert following code into your Allure Config file, to enable Allure Service features for the project:",
|
|
38
|
+
"",
|
|
39
|
+
green("{"),
|
|
40
|
+
green(" allureService: {"),
|
|
41
|
+
green(` project: "${res.project}"`),
|
|
42
|
+
green(" }"),
|
|
43
|
+
green("}"),
|
|
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;
|
|
52
|
+
}
|
|
53
|
+
await logError("Failed to get projects due to unexpected error", error);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
export const ProjectsListCommand = createCommand({
|
|
58
|
+
name: "projects",
|
|
59
|
+
description: "Shows list of all available projects for current user",
|
|
60
|
+
options: [
|
|
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,
|
|
75
|
+
});
|
package/dist/commands/run.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export type RunCommandOptions = {
|
|
|
6
6
|
rerun?: number;
|
|
7
7
|
silent?: boolean;
|
|
8
8
|
} & Record<"--", string[]>;
|
|
9
|
-
export declare const RunCommandAction: (options: RunCommandOptions) => Promise<
|
|
9
|
+
export declare const RunCommandAction: (options: RunCommandOptions) => Promise<void>;
|
|
10
10
|
export declare const RunCommand: (cli: import("cac").CAC) => void;
|
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";
|
|
6
7
|
import * as console from "node:console";
|
|
7
8
|
import { mkdtemp, realpath, rm, writeFile } from "node:fs/promises";
|
|
8
9
|
import { tmpdir } from "node:os";
|
|
9
10
|
import { join, resolve } from "node:path";
|
|
10
11
|
import process from "node:process";
|
|
12
|
+
import { red } from "yoctocolors";
|
|
11
13
|
import { createCommand } from "../utils/commands.js";
|
|
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();
|
|
@@ -80,48 +83,59 @@ export const RunCommandAction = async (options) => {
|
|
|
80
83
|
console.error("could not clean output directory", e);
|
|
81
84
|
}
|
|
82
85
|
}
|
|
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
|
-
|
|
86
|
+
try {
|
|
87
|
+
const allureReport = new AllureReport({
|
|
88
|
+
...config,
|
|
89
|
+
realTime: false,
|
|
90
|
+
plugins: [
|
|
91
|
+
...(config.plugins?.length
|
|
92
|
+
? config.plugins
|
|
93
|
+
: [
|
|
94
|
+
{
|
|
95
|
+
id: "awesome",
|
|
96
|
+
enabled: true,
|
|
97
|
+
options: {},
|
|
98
|
+
plugin: new Awesome({
|
|
99
|
+
reportName: config.name,
|
|
100
|
+
}),
|
|
101
|
+
},
|
|
102
|
+
]),
|
|
103
|
+
],
|
|
104
|
+
});
|
|
105
|
+
await allureReport.start();
|
|
106
|
+
let code = await runTests(allureReport, cwd, command, commandArgs, {}, silent);
|
|
107
|
+
for (let rerun = 0; rerun < maxRerun; rerun++) {
|
|
108
|
+
const failed = await allureReport.store.failedTestResults();
|
|
109
|
+
if (failed.length === 0) {
|
|
110
|
+
console.log("no failed tests is detected.");
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
const testPlan = createTestPlan(failed);
|
|
114
|
+
console.log(`rerun number ${rerun} of ${testPlan.tests.length} tests:`);
|
|
115
|
+
logTests(failed);
|
|
116
|
+
const tmpDir = await mkdtemp(join(tmpdir(), "allure-run-"));
|
|
117
|
+
const testPlanPath = resolve(tmpDir, `${rerun}-testplan.json`);
|
|
118
|
+
await writeFile(testPlanPath, JSON.stringify(testPlan));
|
|
119
|
+
code = await runTests(allureReport, cwd, command, commandArgs, {
|
|
120
|
+
ALLURE_TESTPLAN_PATH: testPlanPath,
|
|
121
|
+
ALLURE_RERUN: `${rerun}`,
|
|
122
|
+
}, silent);
|
|
123
|
+
await rm(tmpDir, { recursive: true });
|
|
124
|
+
logTests(await allureReport.store.allTestResults());
|
|
125
|
+
}
|
|
126
|
+
await allureReport.done();
|
|
127
|
+
await allureReport.validate();
|
|
128
|
+
process.exit(code ?? allureReport.exitCode);
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
if (error instanceof KnownError) {
|
|
132
|
+
console.error(red(error.message));
|
|
133
|
+
process.exit(1);
|
|
134
|
+
return;
|
|
108
135
|
}
|
|
109
|
-
|
|
110
|
-
|
|
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());
|
|
136
|
+
await logError("Failed to run tests using Allure due to unexpected error", error);
|
|
137
|
+
process.exit(1);
|
|
121
138
|
}
|
|
122
|
-
await allureReport.done();
|
|
123
|
-
await allureReport.validate();
|
|
124
|
-
process.exit(code ?? allureReport.exitCode);
|
|
125
139
|
};
|
|
126
140
|
export const RunCommand = createCommand({
|
|
127
141
|
name: "run",
|
package/dist/commands/slack.d.ts
CHANGED
package/dist/commands/slack.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import { AllureReport,
|
|
1
|
+
import { AllureReport, enforcePlugin, readConfig } from "@allurereport/core";
|
|
2
|
+
import SlackPlugin from "@allurereport/plugin-slack";
|
|
2
3
|
import * as console from "node:console";
|
|
4
|
+
import { realpath } from "node:fs/promises";
|
|
5
|
+
import process from "node:process";
|
|
3
6
|
import { createCommand } from "../utils/commands.js";
|
|
4
7
|
export const SlackCommandAction = async (resultsDir, options) => {
|
|
8
|
+
const cwd = await realpath(options.cwd ?? process.cwd());
|
|
5
9
|
const before = new Date().getTime();
|
|
6
|
-
const config =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const { config: configPath, token, channel } = options;
|
|
11
|
+
const defaultSlackOptions = {
|
|
12
|
+
token,
|
|
13
|
+
channel,
|
|
14
|
+
};
|
|
15
|
+
const config = enforcePlugin(await readConfig(cwd, configPath), {
|
|
16
|
+
id: "slack",
|
|
17
|
+
enabled: true,
|
|
18
|
+
options: defaultSlackOptions,
|
|
19
|
+
plugin: new SlackPlugin(defaultSlackOptions),
|
|
12
20
|
});
|
|
13
21
|
const allureReport = new AllureReport(config);
|
|
14
22
|
await allureReport.start();
|
|
@@ -21,6 +29,18 @@ export const SlackCommand = createCommand({
|
|
|
21
29
|
name: "slack <resultsDir>",
|
|
22
30
|
description: "Posts test results into Slack Channel",
|
|
23
31
|
options: [
|
|
32
|
+
[
|
|
33
|
+
"--config, -c <file>",
|
|
34
|
+
{
|
|
35
|
+
description: "The path Allure config file",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
"--cwd <cwd>",
|
|
40
|
+
{
|
|
41
|
+
description: "The working directory for the command to run (Default: current working directory)",
|
|
42
|
+
},
|
|
43
|
+
],
|
|
24
44
|
[
|
|
25
45
|
"--token, -t <token>",
|
|
26
46
|
{
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { readConfig } from "@allurereport/core";
|
|
2
|
+
import { AllureServiceClient, KnownError } from "@allurereport/service";
|
|
3
|
+
import { green, red } from "yoctocolors";
|
|
4
|
+
import { createCommand } from "../utils/commands.js";
|
|
5
|
+
import { logError } from "../utils/logs.js";
|
|
6
|
+
export const WhoamiCommandAction = async (options) => {
|
|
7
|
+
const { config: configPath, cwd } = options ?? {};
|
|
8
|
+
const config = await readConfig(cwd, configPath);
|
|
9
|
+
if (!config?.allureService?.url) {
|
|
10
|
+
console.error(red("No Allure Service URL is provided. Please provide it in the `allureService.url` field in the `allure.config.js` file"));
|
|
11
|
+
process.exit(1);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const serviceClient = new AllureServiceClient(config.allureService);
|
|
15
|
+
try {
|
|
16
|
+
const profile = await serviceClient.profile();
|
|
17
|
+
const lines = [`You are logged in as "${profile.email}"`];
|
|
18
|
+
if (config.allureService?.project) {
|
|
19
|
+
lines.push(`Current project is "${config.allureService.project}"`);
|
|
20
|
+
}
|
|
21
|
+
console.info(green(lines.join("\n")));
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
if (error instanceof KnownError) {
|
|
25
|
+
console.error(red(error.message));
|
|
26
|
+
process.exit(1);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
await logError("Failed to get profile due to unexpected error", error);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export const WhoamiCommand = createCommand({
|
|
34
|
+
name: "whoami",
|
|
35
|
+
description: "Prints information about current user",
|
|
36
|
+
options: [
|
|
37
|
+
[
|
|
38
|
+
"--config, -c <file>",
|
|
39
|
+
{
|
|
40
|
+
description: "The path Allure config file",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
"--cwd <cwd>",
|
|
45
|
+
{
|
|
46
|
+
description: "The working directory for the command to run (default: current working directory)",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
],
|
|
50
|
+
action: WhoamiCommandAction,
|
|
51
|
+
});
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { cac } from "cac";
|
|
|
2
2
|
import console from "node:console";
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
import { cwd } from "node:process";
|
|
5
|
-
import { AwesomeCommand, ClassicCommand, ClassicLegacyCommand, CsvCommand, DashboardCommand, GenerateCommand, HistoryCommand, KnownIssueCommand, LogCommand, OpenCommand, QualityGateCommand, RunCommand, SlackCommand, TestPlanCommand, WatchCommand, } from "./commands/index.js";
|
|
5
|
+
import { AwesomeCommand, ClassicCommand, ClassicLegacyCommand, CsvCommand, DashboardCommand, GenerateCommand, HistoryCommand, KnownIssueCommand, LogCommand, LoginCommand, LogoutCommand, OpenCommand, ProjectsCreateCommand, ProjectsDeleteCommand, ProjectsListCommand, QualityGateCommand, RunCommand, SlackCommand, TestPlanCommand, WatchCommand, WhoamiCommand, } from "./commands/index.js";
|
|
6
6
|
const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
7
7
|
const cli = cac(pkg.name).usage(pkg.description).help().version(pkg.version);
|
|
8
8
|
const commands = [
|
|
@@ -21,12 +21,19 @@ const commands = [
|
|
|
21
21
|
SlackCommand,
|
|
22
22
|
TestPlanCommand,
|
|
23
23
|
WatchCommand,
|
|
24
|
+
LoginCommand,
|
|
25
|
+
LogoutCommand,
|
|
26
|
+
WhoamiCommand,
|
|
27
|
+
ProjectsCreateCommand,
|
|
28
|
+
ProjectsDeleteCommand,
|
|
29
|
+
ProjectsListCommand,
|
|
24
30
|
];
|
|
25
31
|
commands.forEach((command) => {
|
|
26
32
|
command(cli);
|
|
27
33
|
});
|
|
28
34
|
cli.on("command:*", () => {
|
|
29
|
-
console.error(
|
|
35
|
+
console.error(`Invalid command: "${cli.args.join(" ")}"`);
|
|
36
|
+
console.error("See --help for a list of available commands");
|
|
30
37
|
process.exit(1);
|
|
31
38
|
});
|
|
32
39
|
console.log(cwd());
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { red } from "yoctocolors";
|
|
5
|
+
const LOGS_DIRECTORY = join(homedir(), ".allure", "logs");
|
|
6
|
+
export const getLogFileName = () => `${new Date().toISOString().replace(/:/g, "-")}.log`;
|
|
7
|
+
export const readLogs = async () => {
|
|
8
|
+
await mkdir(LOGS_DIRECTORY, { recursive: true });
|
|
9
|
+
const logFilePath = join(LOGS_DIRECTORY, getLogFileName());
|
|
10
|
+
try {
|
|
11
|
+
const logs = await readFile(logFilePath, "utf-8");
|
|
12
|
+
return logs;
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export const logError = async (message, error) => {
|
|
19
|
+
let logs = await readLogs();
|
|
20
|
+
if (!logs) {
|
|
21
|
+
logs += `${new Date().toISOString()}[ERROR] ${error.message}\n`;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
logs += `\n${new Date().toISOString()}[ERROR] ${error.message}\n`;
|
|
25
|
+
}
|
|
26
|
+
if (error.stack) {
|
|
27
|
+
logs += `${error.stack}\n`;
|
|
28
|
+
}
|
|
29
|
+
const logFilePath = join(LOGS_DIRECTORY, getLogFileName());
|
|
30
|
+
await writeFile(logFilePath, logs, "utf-8");
|
|
31
|
+
console.error(red(`${message}. Check logs for more details: ${logFilePath}`));
|
|
32
|
+
};
|
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.16",
|
|
4
4
|
"description": "Allure Commandline Tool",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -30,21 +30,25 @@
|
|
|
30
30
|
"test": "vitest run"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@allurereport/core": "3.0.0-beta.
|
|
34
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
35
|
-
"@allurereport/directory-watcher": "3.0.0-beta.
|
|
36
|
-
"@allurereport/plugin-allure2": "3.0.0-beta.
|
|
37
|
-
"@allurereport/plugin-api": "3.0.0-beta.
|
|
38
|
-
"@allurereport/plugin-awesome": "3.0.0-beta.
|
|
39
|
-
"@allurereport/plugin-classic": "3.0.0-beta.
|
|
40
|
-
"@allurereport/plugin-
|
|
41
|
-
"@allurereport/plugin-
|
|
42
|
-
"@allurereport/plugin-
|
|
43
|
-
"@allurereport/plugin-
|
|
44
|
-
"@allurereport/
|
|
45
|
-
"@allurereport/
|
|
33
|
+
"@allurereport/core": "3.0.0-beta.16",
|
|
34
|
+
"@allurereport/core-api": "3.0.0-beta.16",
|
|
35
|
+
"@allurereport/directory-watcher": "3.0.0-beta.16",
|
|
36
|
+
"@allurereport/plugin-allure2": "3.0.0-beta.16",
|
|
37
|
+
"@allurereport/plugin-api": "3.0.0-beta.16",
|
|
38
|
+
"@allurereport/plugin-awesome": "3.0.0-beta.16",
|
|
39
|
+
"@allurereport/plugin-classic": "3.0.0-beta.16",
|
|
40
|
+
"@allurereport/plugin-csv": "3.0.0-beta.16",
|
|
41
|
+
"@allurereport/plugin-dashboard": "3.0.0-beta.16",
|
|
42
|
+
"@allurereport/plugin-log": "3.0.0-beta.16",
|
|
43
|
+
"@allurereport/plugin-progress": "3.0.0-beta.16",
|
|
44
|
+
"@allurereport/plugin-server-reload": "3.0.0-beta.16",
|
|
45
|
+
"@allurereport/plugin-slack": "3.0.0-beta.16",
|
|
46
|
+
"@allurereport/reader-api": "3.0.0-beta.16",
|
|
47
|
+
"@allurereport/service": "3.0.0-beta.16",
|
|
48
|
+
"@allurereport/static-server": "3.0.0-beta.16",
|
|
46
49
|
"cac": "^6.7.14",
|
|
47
50
|
"lodash.omit": "^4.5.0",
|
|
51
|
+
"prompts": "^2.4.2",
|
|
48
52
|
"yoctocolors": "^2.1.1"
|
|
49
53
|
},
|
|
50
54
|
"devDependencies": {
|
|
@@ -52,10 +56,11 @@
|
|
|
52
56
|
"@types/eslint": "^8.56.11",
|
|
53
57
|
"@types/lodash.omit": "^4.5.9",
|
|
54
58
|
"@types/node": "^20.17.9",
|
|
59
|
+
"@types/prompts": "^2",
|
|
55
60
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
56
61
|
"@typescript-eslint/parser": "^8.0.0",
|
|
57
|
-
"@vitest/runner": "^2.1.
|
|
58
|
-
"@vitest/snapshot": "^2.1.
|
|
62
|
+
"@vitest/runner": "^2.1.9",
|
|
63
|
+
"@vitest/snapshot": "^2.1.9",
|
|
59
64
|
"allure-vitest": "^3.0.9",
|
|
60
65
|
"eslint": "^8.57.0",
|
|
61
66
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -66,6 +71,6 @@
|
|
|
66
71
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
67
72
|
"rimraf": "^6.0.1",
|
|
68
73
|
"typescript": "^5.6.3",
|
|
69
|
-
"vitest": "^2.1.
|
|
74
|
+
"vitest": "^2.1.9"
|
|
70
75
|
}
|
|
71
76
|
}
|