allure 3.20.1 → 3.22.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/README.md +64 -3
- package/dist/commands/{agent.js → agents/index.js} +13 -109
- package/dist/commands/agents/lifecycle.d.ts +20 -0
- package/dist/commands/agents/lifecycle.js +91 -0
- package/dist/commands/{agent-run.d.ts → agents/run.d.ts} +1 -13
- package/dist/commands/{agent-run.js → agents/run.js} +12 -67
- package/dist/commands/commons/generate.d.ts +1 -0
- package/dist/commands/commons/generate.js +28 -2
- package/dist/commands/generate.d.ts +2 -0
- package/dist/commands/generate.js +19 -1
- package/dist/commands/ghWorkflow.d.ts +11 -0
- package/dist/commands/ghWorkflow.js +77 -0
- package/dist/commands/index.d.ts +4 -1
- package/dist/commands/index.js +4 -1
- package/dist/commands/jira/clear.js +3 -3
- package/dist/commands/migrate.d.ts +6 -0
- package/dist/commands/migrate.js +15 -0
- package/dist/commands/open.d.ts +3 -10
- package/dist/commands/open.js +20 -99
- package/dist/commands/qualityGate.js +11 -1
- package/dist/commands/run.d.ts +4 -0
- package/dist/commands/run.js +27 -5
- package/dist/commands/serve.d.ts +19 -0
- package/dist/commands/serve.js +168 -0
- package/dist/commands/slack.d.ts +3 -2
- package/dist/commands/slack.js +17 -5
- package/dist/commands/testopsPlan.js +4 -4
- package/dist/commands/watch.d.ts +1 -0
- package/dist/commands/watch.js +10 -1
- package/dist/index.js +32 -9
- package/dist/utils/allure2Hints.d.ts +8 -0
- package/dist/utils/allure2Hints.js +90 -0
- package/dist/utils/cleanOutput.d.ts +9 -0
- package/dist/utils/cleanOutput.js +62 -0
- package/dist/utils/fileSystem.d.ts +4 -1
- package/dist/utils/fileSystem.js +3 -3
- package/dist/utils/ghWorkflow.d.ts +10 -0
- package/dist/utils/ghWorkflow.js +75 -0
- package/dist/utils/serverOptions.d.ts +5 -0
- package/dist/utils/serverOptions.js +4 -0
- package/dist/utils/updateNotifier.d.ts +6 -0
- package/dist/utils/updateNotifier.js +58 -0
- package/dist/utils/verbosity.d.ts +7 -0
- package/dist/utils/verbosity.js +32 -0
- package/package.json +35 -28
- /package/dist/commands/{agent-human-report.d.ts → agents/human-report.d.ts} +0 -0
- /package/dist/commands/{agent-human-report.js → agents/human-report.js} +0 -0
- /package/dist/commands/{agent.d.ts → agents/index.d.ts} +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { UsageError } from "clipanion";
|
|
2
|
+
import { normalizeCommandEnvironmentOptions } from "./environment.js";
|
|
3
|
+
const SAFE_TOKEN = /^[A-Za-z0-9._/:@=-]+$/;
|
|
4
|
+
const INVISIBLE_CHARS = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u;
|
|
5
|
+
const CHECKOUT_ACTION = "actions/checkout@v6";
|
|
6
|
+
const UPLOAD_ARTIFACT_ACTION = "actions/upload-artifact@v7";
|
|
7
|
+
const DOWNLOAD_ARTIFACT_ACTION = "actions/download-artifact@v8";
|
|
8
|
+
const DEFAULT_TEST_COMMAND = ["npm", "test"];
|
|
9
|
+
const ENVIRONMENT = "${{ matrix.environment }}";
|
|
10
|
+
const NOT_CANCELLED = "${{ !cancelled() }}";
|
|
11
|
+
export const shellQuote = (value) => SAFE_TOKEN.test(value) && !value.startsWith("=") ? value : `'${value.replace(/'/g, `'\\''`)}'`;
|
|
12
|
+
const assertPrintable = (label, value) => {
|
|
13
|
+
if (INVISIBLE_CHARS.test(value)) {
|
|
14
|
+
throw new UsageError(`${label} must not contain control or invisible characters`);
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
};
|
|
18
|
+
export const normalizeEnvironmentIds = (values) => [
|
|
19
|
+
...new Set(values.map((value) => normalizeCommandEnvironmentOptions({ environment: value }).environment)),
|
|
20
|
+
];
|
|
21
|
+
export const configuredEnvironmentIds = (environments) => {
|
|
22
|
+
const ids = Object.keys(environments ?? {});
|
|
23
|
+
if (ids.length === 0) {
|
|
24
|
+
throw new UsageError("The Allure config has no environments (or no allurerc file was found). " +
|
|
25
|
+
"Declare `environments` in the config or pass environment ids with --env");
|
|
26
|
+
}
|
|
27
|
+
return ids;
|
|
28
|
+
};
|
|
29
|
+
export const buildGhWorkflowYaml = ({ environmentIds, testCommand = DEFAULT_TEST_COMMAND, config, }) => {
|
|
30
|
+
if (environmentIds.length === 0) {
|
|
31
|
+
throw new UsageError("At least one environment is required");
|
|
32
|
+
}
|
|
33
|
+
const testCommandLine = testCommand.map((token) => shellQuote(assertPrintable("The test command", token))).join(" ");
|
|
34
|
+
const configOption = config === undefined ? "" : ` --config=${shellQuote(assertPrintable("--config", config))}`;
|
|
35
|
+
const matrix = environmentIds.map((id) => JSON.stringify(id)).join(", ");
|
|
36
|
+
const results = `allure-results-${ENVIRONMENT}`;
|
|
37
|
+
return `# Generated by "allure gh-workflow". Paste it under "jobs:" and adjust the TODO steps.
|
|
38
|
+
test:
|
|
39
|
+
name: Test (${ENVIRONMENT})
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
strategy:
|
|
42
|
+
fail-fast: false
|
|
43
|
+
matrix:
|
|
44
|
+
environment: [${matrix}]
|
|
45
|
+
steps:
|
|
46
|
+
- uses: ${CHECKOUT_ACTION}
|
|
47
|
+
# TODO: set up your runtime and install dependencies
|
|
48
|
+
- name: Test
|
|
49
|
+
run: |
|
|
50
|
+
npx allure run${configOption} --environment=${ENVIRONMENT} --dump=${results} -- ${testCommandLine}
|
|
51
|
+
- name: Upload Allure results
|
|
52
|
+
if: ${NOT_CANCELLED}
|
|
53
|
+
uses: ${UPLOAD_ARTIFACT_ACTION}
|
|
54
|
+
with:
|
|
55
|
+
name: ${results}
|
|
56
|
+
path: ./${results}.zip
|
|
57
|
+
|
|
58
|
+
report:
|
|
59
|
+
name: Report
|
|
60
|
+
needs: [test]
|
|
61
|
+
if: ${NOT_CANCELLED}
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
steps:
|
|
64
|
+
- uses: ${CHECKOUT_ACTION}
|
|
65
|
+
# TODO: set up your runtime and install dependencies
|
|
66
|
+
- name: Download Allure results
|
|
67
|
+
uses: ${DOWNLOAD_ARTIFACT_ACTION}
|
|
68
|
+
with:
|
|
69
|
+
pattern: allure-results-*
|
|
70
|
+
path: ./
|
|
71
|
+
- name: Generate report
|
|
72
|
+
run: |
|
|
73
|
+
npx allure generate${configOption} --dump="allure-results-*/*.zip" --output=./allure-report
|
|
74
|
+
`;
|
|
75
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const isNewerVersion: (candidate: unknown, current: unknown) => boolean;
|
|
2
|
+
export declare const parseUpdateNotifierArgs: (args: string[]) => {
|
|
3
|
+
args: string[];
|
|
4
|
+
disabled: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const notifyAboutUpdate: (args: string[], disabled?: boolean) => Promise<void>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
const parseVersion = (version) => {
|
|
4
|
+
const match = typeof version === "string" && /^(\d+)\.(\d+)\.(\d+)(?:-([a-z][a-z-]*)\.(\d+))?(?:\+[\w.-]+)?$/.exec(version);
|
|
5
|
+
if (!match)
|
|
6
|
+
return undefined;
|
|
7
|
+
const numbers = [Number(match[1]), Number(match[2]), Number(match[3]), ...(match[5] ? [Number(match[5])] : [])];
|
|
8
|
+
if (!numbers.every(Number.isSafeInteger))
|
|
9
|
+
return undefined;
|
|
10
|
+
return { numbers: [...numbers.slice(0, 3), match[5] ? numbers[3] : Infinity], distTag: match[4] ?? "latest" };
|
|
11
|
+
};
|
|
12
|
+
export const isNewerVersion = (candidate, current) => {
|
|
13
|
+
const remote = parseVersion(candidate);
|
|
14
|
+
const local = parseVersion(current);
|
|
15
|
+
if (!remote || !local || (remote.distTag !== "latest" && remote.distTag !== local.distTag))
|
|
16
|
+
return false;
|
|
17
|
+
const index = remote.numbers.findIndex((value, position) => value !== local.numbers[position]);
|
|
18
|
+
return index !== -1 && remote.numbers[index] > local.numbers[index];
|
|
19
|
+
};
|
|
20
|
+
export const parseUpdateNotifierArgs = (args) => {
|
|
21
|
+
const separatorIndex = args.indexOf("--");
|
|
22
|
+
const cliArgs = separatorIndex === -1 ? args : args.slice(0, separatorIndex);
|
|
23
|
+
return {
|
|
24
|
+
args: [...cliArgs.filter((arg) => arg !== "--no-update-notifier"), ...args.slice(cliArgs.length)],
|
|
25
|
+
disabled: cliArgs.includes("--no-update-notifier"),
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export const notifyAboutUpdate = async (args, disabled = false) => {
|
|
29
|
+
const env = process.env;
|
|
30
|
+
const separatorIndex = args.indexOf("--");
|
|
31
|
+
const cliArgs = separatorIndex === -1 ? args : args.slice(0, separatorIndex);
|
|
32
|
+
if (disabled ||
|
|
33
|
+
!process.stderr.isTTY ||
|
|
34
|
+
!cliArgs.length ||
|
|
35
|
+
cliArgs[0] === "agent" ||
|
|
36
|
+
cliArgs.some((arg) => ["--help", "-h", "--version", "-v"].includes(arg)) ||
|
|
37
|
+
env.NO_UPDATE_NOTIFIER !== undefined ||
|
|
38
|
+
env.NODE_ENV === "test" ||
|
|
39
|
+
(env.CI !== undefined && env.CI !== "false" && env.CI !== "0") ||
|
|
40
|
+
env.npm_config_user_agent !== undefined ||
|
|
41
|
+
env.npm_execpath !== undefined)
|
|
42
|
+
return;
|
|
43
|
+
try {
|
|
44
|
+
const pkg = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8"));
|
|
45
|
+
const current = parseVersion(pkg.version);
|
|
46
|
+
if (!current || typeof pkg.name !== "string")
|
|
47
|
+
return;
|
|
48
|
+
const response = await fetch(`https://registry.npmjs.org/${encodeURIComponent(pkg.name)}/${encodeURIComponent(current.distTag)}`, { signal: AbortSignal.timeout(1000) });
|
|
49
|
+
if (!response.ok)
|
|
50
|
+
return;
|
|
51
|
+
const data = (await response.json());
|
|
52
|
+
if (isNewerVersion(data?.version, pkg.version)) {
|
|
53
|
+
process.stderr.write(`\nUpdate available ${pkg.version} → ${data.version}\nUpdate Allure using your package manager (${pkg.name}@${current.distTag}).\n\n`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
}
|
|
58
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type Verbosity = "verbose" | "quiet" | "normal";
|
|
2
|
+
export declare const isQuiet: () => boolean;
|
|
3
|
+
export declare const extractVerbosityFlags: (args: string[]) => {
|
|
4
|
+
args: string[];
|
|
5
|
+
verbosity: Verbosity;
|
|
6
|
+
};
|
|
7
|
+
export declare const applyVerbosity: (verbosity: Verbosity) => void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { setGlobalLogLevel } from "@allurereport/cli-commons";
|
|
2
|
+
import { UsageError } from "clipanion";
|
|
3
|
+
const LOG_LEVELS = {
|
|
4
|
+
verbose: "verbose",
|
|
5
|
+
quiet: "error",
|
|
6
|
+
normal: undefined,
|
|
7
|
+
};
|
|
8
|
+
const isVerboseFlag = (arg) => arg === "--verbose" || arg === "-v";
|
|
9
|
+
const isQuietFlag = (arg) => arg === "--quiet" || arg === "-q";
|
|
10
|
+
let currentVerbosity = "normal";
|
|
11
|
+
export const isQuiet = () => currentVerbosity === "quiet";
|
|
12
|
+
export const extractVerbosityFlags = (args) => {
|
|
13
|
+
if (args.length === 1 && args[0] === "-v") {
|
|
14
|
+
return { args, verbosity: "normal" };
|
|
15
|
+
}
|
|
16
|
+
const separator = args.indexOf("--");
|
|
17
|
+
const own = separator === -1 ? args : args.slice(0, separator);
|
|
18
|
+
const nested = separator === -1 ? [] : args.slice(separator);
|
|
19
|
+
const verbose = own.some(isVerboseFlag);
|
|
20
|
+
const quiet = own.some(isQuietFlag);
|
|
21
|
+
if (verbose && quiet) {
|
|
22
|
+
throw new UsageError("--verbose and --quiet cannot be used together");
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
args: [...own.filter((arg) => !isVerboseFlag(arg) && !isQuietFlag(arg)), ...nested],
|
|
26
|
+
verbosity: verbose ? "verbose" : quiet ? "quiet" : "normal",
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export const applyVerbosity = (verbosity) => {
|
|
30
|
+
currentVerbosity = verbosity;
|
|
31
|
+
setGlobalLogLevel(LOG_LEVELS[verbosity]);
|
|
32
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "allure",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.22.0",
|
|
4
4
|
"description": "Allure Commandline Tool",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -27,33 +27,36 @@
|
|
|
27
27
|
"build": "run clean && tsc --project ./tsconfig.json",
|
|
28
28
|
"clean": "rimraf ./dist",
|
|
29
29
|
"start": "node ./cli.js",
|
|
30
|
-
"test": "
|
|
31
|
-
"
|
|
32
|
-
"lint
|
|
30
|
+
"test": "rimraf out && vp test run",
|
|
31
|
+
"test:unit": "yarn test",
|
|
32
|
+
"lint": "vp lint --import-plugin src test features stories",
|
|
33
|
+
"lint:fix": "vp lint --import-plugin --fix src test features stories"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@allurereport/charts-api": "3.
|
|
36
|
-
"@allurereport/ci": "3.
|
|
37
|
-
"@allurereport/cli-commons": "3.
|
|
38
|
-
"@allurereport/core": "3.
|
|
39
|
-
"@allurereport/core-api": "3.
|
|
40
|
-
"@allurereport/directory-watcher": "3.
|
|
41
|
-
"@allurereport/plugin-agent": "3.
|
|
42
|
-
"@allurereport/plugin-allure2": "3.
|
|
43
|
-
"@allurereport/plugin-api": "3.
|
|
44
|
-
"@allurereport/plugin-awesome": "3.
|
|
45
|
-
"@allurereport/plugin-classic": "3.
|
|
46
|
-
"@allurereport/plugin-csv": "3.
|
|
47
|
-
"@allurereport/plugin-dashboard": "3.
|
|
48
|
-
"@allurereport/plugin-jira": "3.
|
|
49
|
-
"@allurereport/plugin-log": "3.
|
|
50
|
-
"@allurereport/plugin-
|
|
51
|
-
"@allurereport/plugin-
|
|
52
|
-
"@allurereport/plugin-
|
|
53
|
-
"@allurereport/
|
|
54
|
-
"@allurereport/
|
|
55
|
-
"@allurereport/
|
|
56
|
-
"
|
|
36
|
+
"@allurereport/charts-api": "3.22.0",
|
|
37
|
+
"@allurereport/ci": "3.22.0",
|
|
38
|
+
"@allurereport/cli-commons": "3.22.0",
|
|
39
|
+
"@allurereport/core": "3.22.0",
|
|
40
|
+
"@allurereport/core-api": "3.22.0",
|
|
41
|
+
"@allurereport/directory-watcher": "3.22.0",
|
|
42
|
+
"@allurereport/plugin-agent": "3.22.0",
|
|
43
|
+
"@allurereport/plugin-allure2": "3.22.0",
|
|
44
|
+
"@allurereport/plugin-api": "3.22.0",
|
|
45
|
+
"@allurereport/plugin-awesome": "3.22.0",
|
|
46
|
+
"@allurereport/plugin-classic": "3.22.0",
|
|
47
|
+
"@allurereport/plugin-csv": "3.22.0",
|
|
48
|
+
"@allurereport/plugin-dashboard": "3.22.0",
|
|
49
|
+
"@allurereport/plugin-jira": "3.22.0",
|
|
50
|
+
"@allurereport/plugin-log": "3.22.0",
|
|
51
|
+
"@allurereport/plugin-metrics": "3.22.0",
|
|
52
|
+
"@allurereport/plugin-progress": "3.22.0",
|
|
53
|
+
"@allurereport/plugin-server-reload": "3.22.0",
|
|
54
|
+
"@allurereport/plugin-slack": "3.22.0",
|
|
55
|
+
"@allurereport/plugin-xray": "3.22.0",
|
|
56
|
+
"@allurereport/reader-api": "3.22.0",
|
|
57
|
+
"@allurereport/service": "3.22.0",
|
|
58
|
+
"@allurereport/static-server": "3.22.0",
|
|
59
|
+
"adm-zip": "0.6.1",
|
|
57
60
|
"clipanion": "^4.0.0-rc.4",
|
|
58
61
|
"glob": "^13.0.6",
|
|
59
62
|
"lodash.omit": "^4.18.0",
|
|
@@ -62,16 +65,20 @@
|
|
|
62
65
|
"yoctocolors": "^2.2.0"
|
|
63
66
|
},
|
|
64
67
|
"devDependencies": {
|
|
68
|
+
"@allurereport/common-config": "3.22.0",
|
|
65
69
|
"@types/adm-zip": "^0",
|
|
66
70
|
"@types/lodash.omit": "^4.5.9",
|
|
67
71
|
"@types/node": "^20",
|
|
68
72
|
"@types/prompts": "^2",
|
|
73
|
+
"@vitest/coverage-istanbul": "5.0.4",
|
|
69
74
|
"@vitest/runner": "^2",
|
|
70
|
-
"@vitest/snapshot": "
|
|
75
|
+
"@vitest/snapshot": "5.0.4",
|
|
71
76
|
"allure-js-commons": "^3",
|
|
72
77
|
"allure-vitest": "^3",
|
|
73
78
|
"rimraf": "^6",
|
|
74
79
|
"typescript": "^5",
|
|
75
|
-
"
|
|
80
|
+
"vite": "@voidzero-dev/vite-plus-core@1.2.0",
|
|
81
|
+
"vite-plus": "1.2.0",
|
|
82
|
+
"vitest": "5.0.4"
|
|
76
83
|
}
|
|
77
84
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|