@allurereport/plugin-log 3.0.0-beta.9 → 3.0.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/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { LogPlugin } from "./plugin.js";
2
- export default LogPlugin;
1
+ export { type LogPluginOptions } from "./model.js";
2
+ export { LogPlugin as default } from "./plugin.js";
package/dist/index.js CHANGED
@@ -1,2 +1 @@
1
- import { LogPlugin } from "./plugin.js";
2
- export default LogPlugin;
1
+ export { LogPlugin as default } from "./plugin.js";
package/dist/model.d.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import type { TestResult } from "@allurereport/core-api";
1
2
  export type LogPluginOptions = {
2
3
  allSteps?: boolean;
3
4
  withTrace?: boolean;
4
5
  groupBy?: "suites" | "features" | "packages" | "none";
6
+ filter?: (testResult: TestResult) => boolean;
5
7
  };
package/dist/plugin.js CHANGED
@@ -5,19 +5,20 @@ export class LogPlugin {
5
5
  constructor(options = {}) {
6
6
  this.options = options;
7
7
  this.done = async (context, store) => {
8
- const { groupBy = "suite" } = this.options ?? {};
8
+ const { groupBy = "suite", filter = () => true } = this.options ?? {};
9
9
  const allTestResults = await store.allTestResults();
10
+ const filteredTestResults = allTestResults.filter(filter);
10
11
  if (groupBy === "none") {
11
- allTestResults.forEach((test) => {
12
+ filteredTestResults.forEach((test) => {
12
13
  printTest(test, this.options);
13
14
  });
14
15
  console.log("");
15
- printSummary(Array.from(allTestResults));
16
+ printSummary(filteredTestResults, { total: allTestResults.length, filtered: filteredTestResults.length });
16
17
  return;
17
18
  }
18
19
  const groupedTests = await store.testResultsByLabel(groupBy);
19
20
  Object.keys(groupedTests).forEach((key) => {
20
- const tests = groupedTests[key];
21
+ const tests = groupedTests[key].filter(filter);
21
22
  if (tests.length === 0) {
22
23
  return;
23
24
  }
@@ -32,7 +33,10 @@ export class LogPlugin {
32
33
  });
33
34
  console.log("");
34
35
  });
35
- printSummary(Array.from(allTestResults));
36
+ printSummary(filteredTestResults, {
37
+ total: allTestResults.length,
38
+ filtered: filteredTestResults.length,
39
+ });
36
40
  };
37
41
  }
38
42
  }
package/dist/utils.d.ts CHANGED
@@ -8,4 +8,7 @@ export declare const stringifyTestResultTitle: (result: TestResult) => string;
8
8
  export declare const stringifyStepResultTitle: (result: DefaultTestStepResult) => string;
9
9
  export declare const printTest: (test: TestResult, options?: PrintFunctionOptions, indent?: number) => void;
10
10
  export declare const printStep: (step: DefaultTestStepResult, options?: PrintFunctionOptions, indent?: number) => void;
11
- export declare const printSummary: (results: TestResult[]) => void;
11
+ export declare const printSummary: (results: TestResult[], options: {
12
+ total: number;
13
+ filtered: number;
14
+ }) => void;
package/dist/utils.js CHANGED
@@ -88,7 +88,8 @@ export const printStep = (step, options, indent = 0) => {
88
88
  printStep(child, options, indent + 1);
89
89
  });
90
90
  };
91
- export const printSummary = (results) => {
91
+ export const printSummary = (results, options) => {
92
+ const { total, filtered } = options;
92
93
  const statsCounters = {
93
94
  passed: 0,
94
95
  failed: 0,
@@ -130,7 +131,12 @@ export const printSummary = (results) => {
130
131
  console.info("No test results found to show");
131
132
  return;
132
133
  }
133
- console.info(`Total tests: ${results.length}`);
134
+ if (total === filtered) {
135
+ console.info(`Total tests: ${filtered}`);
136
+ }
137
+ else {
138
+ console.info(`Total tests: ${filtered} (of ${total})`);
139
+ }
134
140
  console.info(`Tests: ${stringifiedCounters.join(" | ")}`);
135
141
  console.info(`Duration: ${yellow((totalDuration / 1000).toString())}s`);
136
142
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-log",
3
- "version": "3.0.0-beta.9",
3
+ "version": "3.0.0",
4
4
  "description": "Allure Plugin to write report in stdout",
5
5
  "keywords": [
6
6
  "allure",
@@ -31,8 +31,8 @@
31
31
  "test": "rimraf ./out && vitest run"
32
32
  },
33
33
  "dependencies": {
34
- "@allurereport/core-api": "3.0.0-beta.9",
35
- "@allurereport/plugin-api": "3.0.0-beta.9",
34
+ "@allurereport/core-api": "3.0.0",
35
+ "@allurereport/plugin-api": "3.0.0",
36
36
  "yoctocolors": "^2.1.1"
37
37
  },
38
38
  "devDependencies": {
@@ -41,9 +41,9 @@
41
41
  "@types/node": "^20.17.9",
42
42
  "@typescript-eslint/eslint-plugin": "^8.0.0",
43
43
  "@typescript-eslint/parser": "^8.0.0",
44
- "@vitest/runner": "^2.1.8",
45
- "@vitest/snapshot": "^2.1.8",
46
- "allure-vitest": "^3.0.9",
44
+ "@vitest/runner": "^2.1.9",
45
+ "@vitest/snapshot": "^2.1.9",
46
+ "allure-vitest": "^3.3.3",
47
47
  "eslint": "^8.57.0",
48
48
  "eslint-config-prettier": "^9.1.0",
49
49
  "eslint-plugin-import": "^2.29.1",
@@ -53,6 +53,6 @@
53
53
  "eslint-plugin-prefer-arrow": "^1.2.3",
54
54
  "rimraf": "^6.0.1",
55
55
  "typescript": "^5.6.3",
56
- "vitest": "^2.1.8"
56
+ "vitest": "^2.1.9"
57
57
  }
58
58
  }