@allurereport/plugin-log 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 CHANGED
@@ -49,7 +49,7 @@ The plugin accepts the following options:
49
49
  | Option | Description | Type | Default |
50
50
  |----------------------|-------------------------------------------------------|-----------------------------------------------------|---------------------------------|
51
51
  | `allSteps` | Include all steps in the report | `boolean` | `false` |
52
- | `withTrace` | Include step trace in the report | `boolean` | `false` |
52
+ | `withTrace` | Include test, step, and global error traces in logs | `boolean` | `false` |
53
53
  | `groupBy` | Group tests by given label | `suite \| feature \| package \| suites \| features \| packages \| none` | `suite` |
54
54
  | `qualityGateResults` | Include quality gate validation results in logs | `boolean` | `true` |
55
55
  | `qualityGateFilter` | Select quality gate validation results shown in logs | `(result: QualityGateValidationResult) => boolean` | `({ success }) => !success` |
package/dist/plugin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as console from "node:console";
2
2
  import { gray } from "yoctocolors";
3
- import { printQualityGateResults, printSummary, printTest } from "./utils.js";
3
+ import { printGlobalErrors, printQualityGateResults, printSummary, printTest } from "./utils.js";
4
4
  const defaultQualityGateFilter = ({ success }) => !success;
5
5
  export class LogPlugin {
6
6
  constructor(options = {}) {
@@ -9,6 +9,7 @@ export class LogPlugin {
9
9
  const { groupBy = "suite", filter = () => true, qualityGateResults = true, qualityGateFilter = defaultQualityGateFilter, } = this.options ?? {};
10
10
  const allTestResults = await store.allTestResults();
11
11
  const filteredTestResults = allTestResults.filter(filter);
12
+ const globalErrors = await store.allGlobalErrors();
12
13
  const qualityGateResultsToPrint = qualityGateResults
13
14
  ? (await store.qualityGateResults()).filter(qualityGateFilter)
14
15
  : [];
@@ -44,6 +45,7 @@ export class LogPlugin {
44
45
  if (qualityGateResults) {
45
46
  printQualityGateResults(qualityGateResultsToPrint);
46
47
  }
48
+ printGlobalErrors(globalErrors, this.options);
47
49
  };
48
50
  }
49
51
  }
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DefaultTestStepResult, TestResult, TestStatus, TestStepResult } from "@allurereport/core-api";
1
+ import type { DefaultTestStepResult, TestError, TestResult, TestStatus, TestStepResult } from "@allurereport/core-api";
2
2
  import type { QualityGateValidationResult } from "@allurereport/plugin-api";
3
3
  import type { LogPluginOptions } from "./model.js";
4
4
  export type PrintFunctionOptions = Pick<LogPluginOptions, "allSteps" | "groupBy" | "withTrace">;
@@ -16,3 +16,5 @@ export declare const printSummary: (results: TestResult[], options: {
16
16
  }) => void;
17
17
  export declare const printQualityGateResult: (result: QualityGateValidationResult, indent?: number) => void;
18
18
  export declare const printQualityGateResults: (results: QualityGateValidationResult[]) => void;
19
+ export declare const printGlobalError: (error: TestError, options?: PrintFunctionOptions, indent?: number) => void;
20
+ export declare const printGlobalErrors: (errors: TestError[], options?: PrintFunctionOptions) => void;
package/dist/utils.js CHANGED
@@ -172,3 +172,24 @@ export const printQualityGateResults = (results) => {
172
172
  }
173
173
  console.info(`Quality gates: ${stats.join(" | ")}`);
174
174
  };
175
+ export const printGlobalError = (error, options, indent = 0) => {
176
+ const indentSpaces = " ".repeat(indent);
177
+ const message = error.message?.trim() ? error.message : "No message provided";
178
+ console.info(`${indentSpaces}${red("⨯")} ${red(message)}`);
179
+ if (options?.withTrace && error.trace) {
180
+ error.trace.split("\n").forEach((line) => {
181
+ console.info(`${indentSpaces} ${gray(line)}`);
182
+ });
183
+ }
184
+ };
185
+ export const printGlobalErrors = (errors, options) => {
186
+ if (errors.length === 0) {
187
+ return;
188
+ }
189
+ console.log("");
190
+ console.info("Global errors");
191
+ errors.forEach((error) => {
192
+ printGlobalError(error, options, 1);
193
+ });
194
+ console.info(`Global errors: ${red(`${errors.length} failed`)}`);
195
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-log",
3
- "version": "3.20.1",
3
+ "version": "3.22.0",
4
4
  "description": "Allure Plugin to write report in stdout",
5
5
  "keywords": [
6
6
  "allure",
@@ -26,23 +26,28 @@
26
26
  "scripts": {
27
27
  "build": "run clean && tsc --project ./tsconfig.json",
28
28
  "clean": "rimraf ./dist",
29
- "test": "rimraf ./out && vitest run",
30
- "lint": "oxlint --import-plugin src test features stories",
31
- "lint:fix": "oxlint --import-plugin --fix src test features stories"
29
+ "test": "rimraf out && vp test run",
30
+ "test:unit": "yarn test",
31
+ "lint": "vp lint --import-plugin src test features stories",
32
+ "lint:fix": "vp lint --import-plugin --fix src test features stories"
32
33
  },
33
34
  "dependencies": {
34
- "@allurereport/core-api": "3.20.1",
35
- "@allurereport/plugin-api": "3.20.1",
35
+ "@allurereport/core-api": "3.22.0",
36
+ "@allurereport/plugin-api": "3.22.0",
36
37
  "yoctocolors": "^2.2.0"
37
38
  },
38
39
  "devDependencies": {
40
+ "@allurereport/common-config": "3.22.0",
39
41
  "@types/node": "^20",
42
+ "@vitest/coverage-istanbul": "5.0.4",
40
43
  "@vitest/runner": "^2",
41
- "@vitest/snapshot": "^5.0.1",
44
+ "@vitest/snapshot": "5.0.4",
42
45
  "allure-js-commons": "^3",
43
46
  "allure-vitest": "^3",
44
47
  "rimraf": "^6",
45
48
  "typescript": "^5",
46
- "vitest": "^4.1.0"
49
+ "vite": "@voidzero-dev/vite-plus-core@1.2.0",
50
+ "vite-plus": "1.2.0",
51
+ "vitest": "5.0.4"
47
52
  }
48
53
  }