@allurereport/plugin-testplan 3.0.0-beta.3
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 +52 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/plugin.d.ts +12 -0
- package/dist/plugin.js +20 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Testplan Plugin
|
|
2
|
+
|
|
3
|
+
[<img src="https://allurereport.org/public/img/allure-report.svg" height="85px" alt="Allure Report logo" align="right" />](https://allurereport.org "Allure Report")
|
|
4
|
+
|
|
5
|
+
- Learn more about Allure Report at https://allurereport.org
|
|
6
|
+
- 📚 [Documentation](https://allurereport.org/docs/) – discover official documentation for Allure Report
|
|
7
|
+
- ❓ [Questions and Support](https://github.com/orgs/allure-framework/discussions/categories/questions-support) – get help from the team and community
|
|
8
|
+
- 📢 [Official announcements](https://github.com/orgs/allure-framework/discussions/categories/announcements) – be in touch with the latest updates
|
|
9
|
+
- 💬 [General Discussion ](https://github.com/orgs/allure-framework/discussions/categories/general-discussion) – engage in casual conversations, share insights and ideas with the community
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
The plugin generates Allure Testplan file which can be used by Allure integrations to define which tests should be executed.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
Use your favorite package manager to install the package:
|
|
20
|
+
|
|
21
|
+
```shell
|
|
22
|
+
npm add @allurereport/plugin-testplan
|
|
23
|
+
yarn add @allurereport/plugin-testplan
|
|
24
|
+
pnpm add @allurereport/plugin-testplan
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then, add the plugin to the Allure configuration file:
|
|
28
|
+
|
|
29
|
+
```diff
|
|
30
|
+
import { defineConfig } from "allure";
|
|
31
|
+
|
|
32
|
+
export default defineConfig({
|
|
33
|
+
name: "Allure Report",
|
|
34
|
+
output: "./allure-report",
|
|
35
|
+
historyPath: "./history.jsonl",
|
|
36
|
+
plugins: {
|
|
37
|
+
+ testplan: {
|
|
38
|
+
+ options: {
|
|
39
|
+
+ },
|
|
40
|
+
+ },
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Options
|
|
46
|
+
|
|
47
|
+
The plugin accepts the following options:
|
|
48
|
+
|
|
49
|
+
| Option | Description | Type | Default |
|
|
50
|
+
|------------|------------------------------------------------------------------------|-----------------------------------|--------------------------------------------|
|
|
51
|
+
| `fileName` | Testplan filename | `string` | `testplan.json` |
|
|
52
|
+
| `filter` | Function that filters which Test Results should be present in the file | `(result: TestResult) => boolean` | Only unsuccessful tests appear in the file |
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type TestResult } from "@allurereport/core-api";
|
|
2
|
+
import type { AllureStore, Plugin, PluginContext } from "@allurereport/plugin-api";
|
|
3
|
+
interface TestPlanPluginOptions {
|
|
4
|
+
fileName?: string;
|
|
5
|
+
filter?: (a: TestResult) => boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class TestPlanPlugin implements Plugin {
|
|
8
|
+
readonly options: TestPlanPluginOptions;
|
|
9
|
+
constructor(options?: TestPlanPluginOptions);
|
|
10
|
+
done: (context: PluginContext, store: AllureStore) => Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createTestPlan, filterUnsuccessful } from "@allurereport/core-api";
|
|
2
|
+
import console from "node:console";
|
|
3
|
+
export class TestPlanPlugin {
|
|
4
|
+
constructor(options = {}) {
|
|
5
|
+
this.options = options;
|
|
6
|
+
this.done = async (context, store) => {
|
|
7
|
+
const { reportFiles } = context;
|
|
8
|
+
const testResults = await store.allTestResults();
|
|
9
|
+
const { filter = filterUnsuccessful, fileName = "testplan.json" } = this.options;
|
|
10
|
+
const included = testResults.filter(filter);
|
|
11
|
+
if (included.length === 0) {
|
|
12
|
+
console.log("no tests included to test plan, skipping the generation");
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const testPlan = createTestPlan(included);
|
|
16
|
+
const result = Buffer.from(JSON.stringify(testPlan), "utf-8");
|
|
17
|
+
await reportFiles.addFile(fileName, result);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@allurereport/plugin-testplan",
|
|
3
|
+
"version": "3.0.0-beta.3",
|
|
4
|
+
"description": "Allure Plugin to generate testplan.json",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"allure",
|
|
7
|
+
"testing",
|
|
8
|
+
"report",
|
|
9
|
+
"plugin"
|
|
10
|
+
],
|
|
11
|
+
"repository": "https://github.com/allure-framework/allure3",
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
|
+
"author": "Qameta Software",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"module": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"files": [
|
|
22
|
+
"./dist"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "run clean && tsc --project ./tsconfig.json",
|
|
26
|
+
"clean": "rimraf ./dist",
|
|
27
|
+
"test": "rimraf ./out && vitest run"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@allurereport/core-api": "3.0.0-beta.3",
|
|
31
|
+
"@allurereport/plugin-api": "3.0.0-beta.3"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@stylistic/eslint-plugin": "^2.6.1",
|
|
35
|
+
"@types/eslint": "^8.56.11",
|
|
36
|
+
"@types/node": "^20.17.9",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
38
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
39
|
+
"@vitest/runner": "^2.1.8",
|
|
40
|
+
"allure-vitest": "^3.0.7",
|
|
41
|
+
"eslint": "^8.57.0",
|
|
42
|
+
"eslint-config-prettier": "^9.1.0",
|
|
43
|
+
"eslint-plugin-import": "^2.29.1",
|
|
44
|
+
"eslint-plugin-jsdoc": "^50.0.0",
|
|
45
|
+
"eslint-plugin-n": "^17.10.1",
|
|
46
|
+
"eslint-plugin-no-null": "^1.0.2",
|
|
47
|
+
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
48
|
+
"rimraf": "^6.0.1",
|
|
49
|
+
"typescript": "^5.6.3",
|
|
50
|
+
"vitest": "^2.1.8"
|
|
51
|
+
}
|
|
52
|
+
}
|