@kinora/reporter 0.0.1 → 0.0.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 ADDED
@@ -0,0 +1,76 @@
1
+ # @kinora/reporter
2
+
3
+ Playwright reporter that uploads your test results to a [kinora](https://github.com/joris-gallot/kinora) server: pass rates, trends, flaky tests, and the full Playwright trace for failures, across projects and over time.
4
+
5
+ It runs on `onEnd`, posts the normalized run, then uploads the trace.zip for each failed/flaky test that has one. Upload never fails your test run.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm i -D @kinora/reporter
11
+ # or: pnpm add -D @kinora/reporter
12
+ ```
13
+
14
+ `@playwright/test` (>=1.40) is a peer dependency.
15
+
16
+ ## Usage
17
+
18
+ Add it to `playwright.config.ts`:
19
+
20
+ ```ts
21
+ import { defineConfig } from '@playwright/test'
22
+
23
+ export default defineConfig({
24
+ reporter: [['@kinora/reporter', { project: { slug: 'web-app' } }]],
25
+ // enable tracing so failures upload a trace
26
+ use: { trace: 'on-first-retry' },
27
+ })
28
+ ```
29
+
30
+ The server URL and token come from the environment (keep the token out of the config file):
31
+
32
+ ```bash
33
+ KINORA_URL=https://kinora.example.com KINORA_TOKEN=<project-token> npx playwright test
34
+ ```
35
+
36
+ Create a project API token in the kinora dashboard (Settings → API tokens).
37
+
38
+ ## Options
39
+
40
+ ```ts
41
+ [
42
+ '@kinora/reporter',
43
+ {
44
+ project: { slug: 'web-app', name: 'Web App' },
45
+ },
46
+ ]
47
+ ```
48
+
49
+ | Option | Type | Default | Description |
50
+ | --------- | ------------------------------------ | ---------------------- | ------------------------------------------ |
51
+ | `project` | `{ slug: string, name?: string }` | required | Target project. `name` defaults to `slug`. |
52
+ | `url` | `string` | env `KINORA_URL` | kinora server base URL. |
53
+ | `token` | `string` | env `KINORA_TOKEN` | Project API token. Prefer the env var. |
54
+ | `git` | `{ sha?, branch? }` | auto on GitHub Actions | Git metadata for the run. |
55
+ | `ci` | `{ provider?, runUrl?, runNumber? }` | auto on GitHub Actions | CI metadata for the run. |
56
+
57
+ On GitHub Actions, `git` and `ci` are filled from the standard `GITHUB_*` env vars. Pass them explicitly on other CI providers.
58
+
59
+ ## CI example (GitHub Actions)
60
+
61
+ ```yaml
62
+ - run: npx playwright test
63
+ env:
64
+ KINORA_URL: ${{ vars.KINORA_URL }}
65
+ KINORA_TOKEN: ${{ secrets.KINORA_TOKEN }}
66
+ ```
67
+
68
+ ## Notes
69
+
70
+ - If `KINORA_URL` or `KINORA_TOKEN` is missing, the reporter logs a warning and skips the upload, so local runs aren't affected.
71
+ - Traces are uploaded only for tests that produced one, so enable `trace` in your Playwright config (`on-first-retry`, `retain-on-failure`, etc.).
72
+ - Cross-run test identity is the file + title path + Playwright project name, so history stays stable as long as those don't change.
73
+
74
+ ## License
75
+
76
+ MIT
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import process from "node:process";
3
- import { createIngestClient, isTraceAttachment, makeTestKey } from "@kinora/core";
3
+ import { IngestError, createIngestClient, isTraceAttachment, makeTestKey } from "@kinora/core";
4
4
  //#region src/index.ts
5
5
  function identity(test) {
6
6
  let file = "";
@@ -143,7 +143,8 @@ var KinoraReporter = class {
143
143
  }
144
144
  console.log(`[kinora] uploaded ${res.tests} tests + ${traces} traces (run ${res.runId})`);
145
145
  } catch (err) {
146
- console.error(`[kinora] upload failed:`, err instanceof Error ? err.message : err);
146
+ if (err instanceof IngestError && err.status === 402) console.warn(`[kinora] ${err.message}`);
147
+ else console.error(`[kinora] upload failed:`, err instanceof Error ? err.message : err);
147
148
  }
148
149
  }
149
150
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kinora/reporter",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.0.3",
5
5
  "description": "Playwright reporter that uploads test results to a kinora server",
6
6
  "author": "Joris Gallot",
7
7
  "license": "MIT",
@@ -32,21 +32,20 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "scripts": {
36
- "build": "tsdown",
37
- "typecheck": "tsc --noEmit",
38
- "prepublishOnly": "tsdown"
39
- },
40
35
  "peerDependencies": {
41
36
  "@playwright/test": ">=1.40.0"
42
37
  },
43
38
  "dependencies": {
44
- "@kinora/core": "workspace:*"
39
+ "@kinora/core": "0.0.3"
45
40
  },
46
41
  "devDependencies": {
47
42
  "@playwright/test": "^1.60.0",
48
43
  "@types/node": "^24.12.3",
49
44
  "tsdown": "^0.22.2",
50
45
  "typescript": "~6.0.2"
46
+ },
47
+ "scripts": {
48
+ "build": "tsdown",
49
+ "typecheck": "tsc --noEmit"
51
50
  }
52
- }
51
+ }