@kinora/vitest-reporter 0.3.0 → 0.5.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.mts +0 -4
- package/dist/index.mjs +9 -23
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { AttachmentKind, CiMeta, GitMeta } from "@kinora/core";
|
|
2
2
|
import { Reporter, TestModule, Vitest } from "vitest/node";
|
|
3
|
-
//#region src/convert.d.ts
|
|
4
3
|
type IncludeTests = 'browser' | 'all';
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/index.d.ts
|
|
7
4
|
export interface KinoraVitestReporterOptions {
|
|
8
5
|
/** kinora server base URL. Defaults to env KINORA_URL, then the hosted cloud. Set for self-host. */
|
|
9
6
|
url?: string;
|
|
@@ -41,5 +38,4 @@ export default class KinoraVitestReporter implements Reporter {
|
|
|
41
38
|
onTestRunStart(): void;
|
|
42
39
|
onTestRunEnd(modules: ReadonlyArray<TestModule>): Promise<void>;
|
|
43
40
|
}
|
|
44
|
-
//#endregion
|
|
45
41
|
export {};
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import { DEFAULT_KINORA_URL, DEFAULT_UPLOAD_ATTACHMENTS, IngestError, MAX_A11Y_NODES, MAX_A11Y_VIOLATIONS, STORY_ANNOTATION, axeViolations, createIngestClient,
|
|
4
|
-
|
|
3
|
+
import { DEFAULT_KINORA_URL, DEFAULT_UPLOAD_ATTACHMENTS, IngestError, MAX_A11Y_NODES, MAX_A11Y_VIOLATIONS, STORY_ANNOTATION, artifactsToUpload, axeViolations, createIngestClient, describeRetry, detectCiEnv, makeTestKey, resolveShardGroup, stripAnsi, uploadArtifacts } from "@kinora/core";
|
|
4
|
+
// src/convert.ts
|
|
5
5
|
function identity(test) {
|
|
6
6
|
const file = test.module.relativeModuleId;
|
|
7
7
|
const suites = [];
|
|
@@ -163,8 +163,7 @@ function toNormTests(modules, include = "browser") {
|
|
|
163
163
|
skippedNodeTests
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
|
-
|
|
167
|
-
//#region src/index.ts
|
|
166
|
+
// src/index.ts
|
|
168
167
|
function countsOf(tests) {
|
|
169
168
|
const counts = {
|
|
170
169
|
total: tests.length,
|
|
@@ -234,26 +233,14 @@ var KinoraVitestReporter = class {
|
|
|
234
233
|
try {
|
|
235
234
|
const client = createIngestClient({
|
|
236
235
|
baseUrl: url,
|
|
237
|
-
token
|
|
236
|
+
token,
|
|
237
|
+
onRetry: (info) => console.warn(`[kinora] ${describeRetry(info)}`)
|
|
238
238
|
});
|
|
239
239
|
const res = await client.uploadRun(payload);
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
try {
|
|
245
|
-
await client.uploadArtifact({
|
|
246
|
-
runId: res.runId,
|
|
247
|
-
testKey: t.testKey,
|
|
248
|
-
name: a.name,
|
|
249
|
-
contentType: a.contentType,
|
|
250
|
-
body: await readFile(a.path)
|
|
251
|
-
});
|
|
252
|
-
artifacts++;
|
|
253
|
-
} catch (err) {
|
|
254
|
-
console.warn(`[kinora] ${a.name} upload failed for ${t.testKey}:`, err instanceof Error ? err.message : err);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
240
|
+
const artifacts = await uploadArtifacts(client, res.runId, artifactsToUpload(tests, this.options.uploadAttachments ?? DEFAULT_UPLOAD_ATTACHMENTS), {
|
|
241
|
+
read: readFile,
|
|
242
|
+
onFailed: (a, err) => console.warn(`[kinora] ${a.name} upload failed for ${a.testKey}:`, err instanceof Error ? err.message : err)
|
|
243
|
+
});
|
|
257
244
|
console.log(`[kinora] uploaded ${res.tests} tests + ${artifacts} artifacts (run ${res.runId}${res.shardProgress ? `, ${res.shardProgress.landed} of ${res.shardProgress.total} shards` : ""})`);
|
|
258
245
|
} catch (err) {
|
|
259
246
|
if (err instanceof IngestError && err.status === 402) console.warn(`[kinora] ${err.message}`);
|
|
@@ -261,5 +248,4 @@ var KinoraVitestReporter = class {
|
|
|
261
248
|
}
|
|
262
249
|
}
|
|
263
250
|
};
|
|
264
|
-
//#endregion
|
|
265
251
|
export { KinoraVitestReporter as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kinora/vitest-reporter",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"description": "Vitest reporter that uploads browser-mode and Storybook test results to a kinora server",
|
|
6
6
|
"author": "Joris Gallot",
|
|
7
7
|
"license": "MIT",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"vitest": ">=4.1.12"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@kinora/core": "0.
|
|
40
|
+
"@kinora/core": "0.16.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@types/node": "^26.6.
|
|
44
|
-
"@vitest/coverage-v8": "^5.0
|
|
45
|
-
"tsdown": "^0.23.
|
|
43
|
+
"@types/node": "^26.6.6",
|
|
44
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
45
|
+
"tsdown": "^0.23.7",
|
|
46
46
|
"typescript": "~6.0.3",
|
|
47
|
-
"vitest": "^5.0
|
|
47
|
+
"vitest": "^5.1.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsdown",
|