@reboot-dev/reboot-std 0.22.0 → 0.23.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reboot-dev/reboot-std",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "Reboot standard library.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -10,8 +10,8 @@
10
10
  },
11
11
  "author": "reboot-dev",
12
12
  "dependencies": {
13
- "@reboot-dev/reboot-std-api": "0.22.0",
14
- "@reboot-dev/reboot": "0.22.0"
13
+ "@reboot-dev/reboot-std-api": "0.23.0",
14
+ "@reboot-dev/reboot": "0.23.0"
15
15
  },
16
16
  "license": "Apache-2.0",
17
17
  "devDependencies": {
@@ -21,6 +21,7 @@
21
21
  "./package.json": "./package.json",
22
22
  ".": "./index.js",
23
23
  "./collections/sorted_map.js": "./collections/sorted_map.js",
24
- "./presence": "./presence/index.js"
24
+ "./presence": "./presence/index.js",
25
+ "./vitest": "./vitest/index.js"
25
26
  }
26
27
  }
@@ -0,0 +1,5 @@
1
+ import { TaskResultPack } from "vitest";
2
+ import { BasicReporter } from "vitest/reporters";
3
+ export declare class BetterErrorTracingReporter extends BasicReporter {
4
+ onTaskUpdate(packs: TaskResultPack[]): void;
5
+ }
@@ -0,0 +1,30 @@
1
+ import { BasicReporter } from "vitest/reporters";
2
+ // Vitest, a 'modern' and powerful test framework isn't able to print verbose errors out-of-the-box.
3
+ // Use this vitest reporter to see all errors printed to the console.
4
+ export class BetterErrorTracingReporter extends BasicReporter {
5
+ onTaskUpdate(packs) {
6
+ if (this.isTTY) {
7
+ return;
8
+ }
9
+ for (const pack of packs) {
10
+ const task = this.ctx.state.idMap.get(pack[0]);
11
+ if (task) {
12
+ this.printTask(task);
13
+ }
14
+ if (task &&
15
+ task.type === "test" &&
16
+ task.result?.state &&
17
+ task.result?.state !== "run") {
18
+ if (task.result.state === "fail") {
19
+ task.result.errors?.forEach((error) => {
20
+ this.ctx.logger.error({
21
+ name: error?.name,
22
+ error: error.error,
23
+ code: error.code,
24
+ }, error.stack);
25
+ });
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }