Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"oxlint-tsgolint": "0.16.0",
"rimraf": "^6.0.1",
"tslib": "^2.7.0",
"typescript": "^5.6.3"
"typescript": "^5.6.3",
"yaml": "^2.8.3"
},
"resolutions": {
"@preact/compat": "^18.3.1",
Expand Down
23 changes: 23 additions & 0 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,29 @@ This approach ensures you always use the latest version without managing global

## Commands

### Bootstrapping and Maintaining Setup (`allure kit`)

Allure 3 includes a toolkit to bootstrap and maintain your project setup:

```bash
npx allure kit init
```

Common workflows:

```bash
# Diagnose your setup
npx allure kit doctor

# Manage plugins
npx allure kit plugin list
npx allure kit plugin add dashboard
npx allure kit plugin remove dashboard --uninstall

# Update Allure-related packages
npx allure kit update --yes
```

### Running Tests and Generating Reports

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:
Expand Down
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"lodash.omit": "^4.18.0",
"prompts": "^2.4.2",
"typanion": "^3.14.0",
"yaml": "^2.8.1",
"yoctocolors": "^2.1.1"
},
"devDependencies": {
Expand Down
67 changes: 43 additions & 24 deletions packages/cli/src/commands/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { readConfig } from "@allurereport/core";
import { serve } from "@allurereport/static-server";
import { Command, Option } from "clipanion";

import { buildAllureOpenNextStepCommands } from "../utils/after-command.js";
import { emitTerminalHookEvent, runWithTerminalHooks } from "../utils/terminal-hooks.js";
import { generate } from "./commons/generate.js";

export class GenerateCommand extends Command {
Expand Down Expand Up @@ -71,30 +73,47 @@ export class GenerateCommand extends Command {
});

async execute() {
const cwd = this.cwd ?? processCwd();
const hideLabels = this.hideLabels?.length ? this.hideLabels : undefined;
const config = await readConfig(cwd, this.config, {
name: this.reportName,
output: this.output,
open: this.open,
port: this.port,
hideLabels,
historyLimit: this.historyLimit ? parseInt(this.historyLimit, 10) : undefined,
return runWithTerminalHooks({
commandId: "generate",
payload: {
resultsDir: this.resultsDir,
config: this.config,
output: this.output,
},
run: async () => {
const cwd = this.cwd ?? processCwd();
const hideLabels = this.hideLabels?.length ? this.hideLabels : undefined;
const config = await readConfig(cwd, this.config, {
name: this.reportName,
output: this.output,
open: this.open,
port: this.port,
hideLabels,
historyLimit: this.historyLimit ? parseInt(this.historyLimit, 10) : undefined,
});

await generate({
dump: this.dump,
resultsDir: this.resultsDir ?? "./**/allure-results",
cwd,
config,
});

if (config.open) {
await serve({
port: config.port ? parseInt(config.port, 10) : undefined,
servePath: config.output,
open: true,
});
return;
}

await emitTerminalHookEvent({
kind: "next-step",
text: "You can open the report in your browser with:",
commands: buildAllureOpenNextStepCommands({ cwd, reportPath: config.output }),
});
},
});

await generate({
dump: this.dump,
resultsDir: this.resultsDir ?? "./**/allure-results",
cwd,
config,
});

if (config.open) {
await serve({
port: config.port ? parseInt(config.port, 10) : undefined,
servePath: config.output,
open: true,
});
}
}
}
1 change: 1 addition & 0 deletions packages/cli/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ export * from "./dashboard.js";
export * from "./results/index.js";
export * from "./jira/index.js";
export * from "./whoami.js";
export * from "./kit/index.js";
91 changes: 91 additions & 0 deletions packages/cli/src/commands/kit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Allure Kit (`allure kit`)

`allure kit` is a set of CLI commands for bootstrapping and maintaining an Allure 3 setup in JavaScript/TypeScript projects.

It helps you:
- detect test frameworks and install matching Allure adapters,
- create and maintain `allurerc` config files,
- manage report plugins,
- diagnose setup issues.

Detected frameworks include popular runners like Vitest, Playwright, Jest, Mocha, Cypress, Cucumber.js, Jasmine, CodeceptJS, Newman, and WebdriverIO (WDIO).

## Run

Use without global install:

```bash
npx allure kit --help
```

Run a specific command:

```bash
npx allure kit init
```

## Quick Start

```bash
# 1) Initialize Allure in your project
npx allure kit init

# 2) Run tests so they produce allure-results
npm test

# 3) Build report
npx allure generate
```

If you want a fully non-interactive setup:

```bash
npx allure kit init --yes
```

## Commands

### `init`

```bash
allure kit init [--format json|yaml|mjs] [--yes] [--demo] [--cwd <path>]
```

### `update`

```bash
allure kit update [--yes] [--cwd <path>]
```

### `doctor`

```bash
allure kit doctor [--cwd <path>]
```

### `gh-pages init`

Creates a GitHub Actions workflow that generates an Allure report and publishes it to GitHub Pages via the `gh-pages` branch.

```bash
allure kit gh-pages init [--yes] [--branch <name>] [--config <path>] [--test-command <cmd>] [--cwd <path>]
```

### `plugin list`

```bash
allure kit plugin list [--cwd <path>]
```

### `plugin add`

```bash
allure kit plugin add <name> [--skip-options] [--cwd <path>]
```

### `plugin remove`

```bash
allure kit plugin remove <name> [--uninstall] [--cwd <path>]
```

Loading
Loading