@kinora/vitest-reporter 0.4.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.
Files changed (2) hide show
  1. package/dist/index.mjs +5 -18
  2. package/package.json +6 -6
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 { DEFAULT_KINORA_URL, DEFAULT_UPLOAD_ATTACHMENTS, IngestError, MAX_A11Y_NODES, MAX_A11Y_VIOLATIONS, STORY_ANNOTATION, axeViolations, createIngestClient, describeRetry, detectCiEnv, isUploadableAttachment, makeTestKey, resolveShardGroup, stripAnsi } from "@kinora/core";
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
4
  // src/convert.ts
5
5
  function identity(test) {
6
6
  const file = test.module.relativeModuleId;
@@ -237,23 +237,10 @@ var KinoraVitestReporter = class {
237
237
  onRetry: (info) => console.warn(`[kinora] ${describeRetry(info)}`)
238
238
  });
239
239
  const res = await client.uploadRun(payload);
240
- const kinds = this.options.uploadAttachments ?? DEFAULT_UPLOAD_ATTACHMENTS;
241
- let artifacts = 0;
242
- for (const t of tests) for (const a of t.attachments) {
243
- if (!a.path || !isUploadableAttachment(a, kinds)) continue;
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}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kinora/vitest-reporter",
3
3
  "type": "module",
4
- "version": "0.4.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.14.0"
40
+ "@kinora/core": "0.16.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@types/node": "^26.6.5",
44
- "@vitest/coverage-v8": "^5.0.5",
45
- "tsdown": "^0.23.2",
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.5"
47
+ "vitest": "^5.1.0"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "tsdown",