@kinora/reporter 0.3.0 → 0.4.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 +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.mjs +7 -28
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @kinora/reporter
|
|
2
2
|
|
|
3
|
-
Playwright reporter that uploads your test results to a [kinora](https://github.com/
|
|
3
|
+
Playwright reporter that uploads your test results to a [kinora](https://github.com/kinora-dev/kinora) server: pass rates, trends, flaky tests, and the full Playwright trace for failures, across projects and over time.
|
|
4
4
|
|
|
5
5
|
It runs on `onEnd`, posts the normalized run, then uploads the trace.zip for each test that produced one (videos and screenshots too, see below). Upload never fails your test run.
|
|
6
6
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AttachmentKind, CiMeta, GitMeta } from "@kinora/core";
|
|
2
2
|
import { FullConfig, FullResult, Reporter, Suite } from "@playwright/test/reporter";
|
|
3
|
-
|
|
4
3
|
//#region src/index.d.ts
|
|
5
4
|
interface KinoraReporterOptions {
|
|
6
5
|
/** kinora server base URL. Defaults to env KINORA_URL, then the hosted cloud. Set for self-host. */
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import process from "node:process";
|
|
4
|
-
import { DEFAULT_KINORA_URL, DEFAULT_UPLOAD_ATTACHMENTS, IngestError, createIngestClient, effectiveAttachments, isUploadableAttachment, makeTestKey, postPrComment, resolvePrContext } from "@kinora/core";
|
|
4
|
+
import { DEFAULT_KINORA_URL, DEFAULT_UPLOAD_ATTACHMENTS, IngestError, createIngestClient, detectCiEnv, effectiveAttachments, isUploadableAttachment, makeTestKey, postPrComment, resolvePrContext } from "@kinora/core";
|
|
5
5
|
//#region src/index.ts
|
|
6
6
|
function identity(test) {
|
|
7
7
|
let file = "";
|
|
@@ -68,29 +68,6 @@ function countsOf(tests) {
|
|
|
68
68
|
for (const t of tests) counts[t.status]++;
|
|
69
69
|
return counts;
|
|
70
70
|
}
|
|
71
|
-
function detectGit() {
|
|
72
|
-
const sha = process.env.GITHUB_SHA;
|
|
73
|
-
const branch = process.env.GITHUB_REF_NAME;
|
|
74
|
-
const baseBranch = process.env.GITHUB_BASE_REF || void 0;
|
|
75
|
-
const { GITHUB_SERVER_URL, GITHUB_REPOSITORY } = process.env;
|
|
76
|
-
const repoUrl = GITHUB_SERVER_URL && GITHUB_REPOSITORY ? `${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}` : void 0;
|
|
77
|
-
if (!sha && !branch && !repoUrl) return void 0;
|
|
78
|
-
return {
|
|
79
|
-
sha,
|
|
80
|
-
branch,
|
|
81
|
-
baseBranch,
|
|
82
|
-
repoUrl
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function detectCi() {
|
|
86
|
-
if (!process.env.GITHUB_ACTIONS) return void 0;
|
|
87
|
-
const { GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_RUN_ID, GITHUB_RUN_NUMBER } = process.env;
|
|
88
|
-
return {
|
|
89
|
-
provider: "github",
|
|
90
|
-
runUrl: GITHUB_SERVER_URL && GITHUB_REPOSITORY && GITHUB_RUN_ID ? `${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}` : void 0,
|
|
91
|
-
runNumber: GITHUB_RUN_NUMBER
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
71
|
var KinoraReporter = class {
|
|
95
72
|
options;
|
|
96
73
|
suite;
|
|
@@ -110,6 +87,7 @@ var KinoraReporter = class {
|
|
|
110
87
|
return;
|
|
111
88
|
}
|
|
112
89
|
const tests = (this.suite?.allTests() ?? []).map(toNormTest);
|
|
90
|
+
const detected = detectCiEnv(process.env);
|
|
113
91
|
const payload = {
|
|
114
92
|
project: {
|
|
115
93
|
slug: this.options.project.slug,
|
|
@@ -120,8 +98,8 @@ var KinoraReporter = class {
|
|
|
120
98
|
duration: result.duration,
|
|
121
99
|
counts: countsOf(tests),
|
|
122
100
|
playwrightVersion: this.config?.version,
|
|
123
|
-
git: this.options.git ??
|
|
124
|
-
ci: this.options.ci ??
|
|
101
|
+
git: this.options.git ?? detected.git,
|
|
102
|
+
ci: this.options.ci ?? detected.ci
|
|
125
103
|
},
|
|
126
104
|
tests
|
|
127
105
|
};
|
|
@@ -162,10 +140,11 @@ var KinoraReporter = class {
|
|
|
162
140
|
const label = typeof opt === "object" ? opt.label : void 0;
|
|
163
141
|
const policy = typeof opt === "object" ? opt.policy : void 0;
|
|
164
142
|
try {
|
|
165
|
-
const
|
|
143
|
+
const env = this.config?.shard ? {
|
|
166
144
|
...process.env,
|
|
167
145
|
__KINORA_IS_SHARD: "1"
|
|
168
|
-
} : process.env
|
|
146
|
+
} : process.env;
|
|
147
|
+
const ctx = resolvePrContext(env, (p) => {
|
|
169
148
|
try {
|
|
170
149
|
return readFileSync(p, "utf8");
|
|
171
150
|
} catch {
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kinora/reporter",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"description": "Playwright reporter that uploads test results to a kinora server",
|
|
6
6
|
"author": "Joris Gallot",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"homepage": "https://github.com/
|
|
8
|
+
"homepage": "https://github.com/kinora-dev/kinora#readme",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/
|
|
11
|
+
"url": "git+https://github.com/kinora-dev/kinora.git",
|
|
12
12
|
"directory": "packages/reporter"
|
|
13
13
|
},
|
|
14
|
-
"bugs": "https://github.com/
|
|
14
|
+
"bugs": "https://github.com/kinora-dev/kinora/issues",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"playwright",
|
|
17
17
|
"reporter",
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"@playwright/test": ">=1.40.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@kinora/core": "0.
|
|
39
|
+
"@kinora/core": "0.4.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@playwright/test": "^1.
|
|
43
|
-
"@types/node": "^26.
|
|
44
|
-
"@vitest/coverage-v8": "^4.1.
|
|
45
|
-
"tsdown": "^0.22.
|
|
42
|
+
"@playwright/test": "^1.63.0",
|
|
43
|
+
"@types/node": "^26.5.1",
|
|
44
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
45
|
+
"tsdown": "^0.22.14",
|
|
46
46
|
"typescript": "~6.0.3",
|
|
47
|
-
"vitest": "^4.1.
|
|
47
|
+
"vitest": "^4.1.11"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsdown",
|