@vitest-agent/plugin 1.1.3 → 1.1.4

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 (3) hide show
  1. package/package.json +6 -6
  2. package/plugin.js +1 -1
  3. package/reporter.js +26 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitest-agent/plugin",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "private": false,
5
5
  "description": "Vitest plugin for the vitest-agent ecosystem: owns persistence, classification, baselines, trends, and dispatches rendering to a configurable reporter.",
6
6
  "keywords": [
@@ -44,17 +44,17 @@
44
44
  "@effect/rpc": "^0.75.1",
45
45
  "@effect/sql": "^0.51.1",
46
46
  "@effect/sql-sqlite-node": "^0.52.0",
47
- "@vitest-agent/reporter": "1.0.3",
48
- "@vitest-agent/sdk": "1.2.0",
47
+ "@vitest-agent/reporter": "1.0.4",
48
+ "@vitest-agent/sdk": "1.3.0",
49
49
  "acorn": "^8.17.0",
50
50
  "acorn-typescript": "^1.4.13",
51
51
  "effect": "^3.21.4",
52
52
  "magic-string": "^0.30.21",
53
- "workspaces-effect": "^1.2.0"
53
+ "workspaces-effect": "^1.3.0"
54
54
  },
55
55
  "peerDependencies": {
56
- "@vitest-agent/cli": "1.0.3",
57
- "@vitest-agent/mcp": "1.3.1",
56
+ "@vitest-agent/cli": "1.0.4",
57
+ "@vitest-agent/mcp": "1.3.2",
58
58
  "@vitest/coverage-istanbul": "^4.1.0",
59
59
  "@vitest/coverage-v8": "^4.1.0",
60
60
  "vitest": "^4.1.0"
package/plugin.js CHANGED
@@ -98,7 +98,7 @@ const aggregatedReporterByVitest = /* @__PURE__ */ new WeakSet();
98
98
  *
99
99
  * @public
100
100
  */
101
- const CURRENT_PLUGIN_VERSION = "1.1.3";
101
+ const CURRENT_PLUGIN_VERSION = "1.1.4";
102
102
  const TEST_FILE_SUFFIX_RE = /\.(?:test|spec)\.(?:ts|tsx|js|jsx)$/;
103
103
  const TEST_FILE_DIR_RE = /\/(?:src|__test__)\//;
104
104
  const isTestFile = (id) => TEST_FILE_SUFFIX_RE.test(id) && TEST_FILE_DIR_RE.test(id);
package/reporter.js CHANGED
@@ -7,7 +7,7 @@ import { captureSettings, hashSettings } from "./utils/capture-settings.js";
7
7
  import { processFailure } from "./utils/process-failure.js";
8
8
  import { routeRenderedOutput } from "./utils/route-rendered-output.js";
9
9
  import { stringifyFailureValue } from "./utils/stringify-failure-value.js";
10
- import { DataReader, DataStore, DetailResolver, EnvironmentDetector, ExecutorResolver, FormatSelector, HistoryTracker, OutputPipelineLive, PathResolutionLive, buildAgentReport, computeTrend, ensureMigrated, formatFatalError, isTimeoutError, probeHostMetadataFromEnv, resolveDataPath, resolveLogFile, resolveLogLevel } from "@vitest-agent/sdk";
10
+ import { DataReader, DataStore, DetailResolver, EnvironmentDetector, ExecutorResolver, FormatSelector, HistoryTracker, OutputPipelineLive, PathResolutionLive, buildAgentReport, computeTrend, ensureMigrated, formatFatalError, historyKey, isTimeoutError, probeHostMetadataFromEnv, resolveDataPath, resolveLogFile, resolveLogLevel } from "@vitest-agent/sdk";
11
11
  import { Effect, Option, PubSub } from "effect";
12
12
  import { randomUUID } from "node:crypto";
13
13
  import { mkdirSync } from "node:fs";
@@ -1131,33 +1131,42 @@ var AgentReporter = class {
1131
1131
  yield* store.writeErrors(runId, inputs);
1132
1132
  }
1133
1133
  const testOutcomes = [];
1134
- for (const mod of projectModules) for (const testCase of mod.children.allTests()) {
1135
- const state = testCase.result()?.state;
1136
- if (state === "passed" || state === "failed") testOutcomes.push({
1137
- fullName: testCase.fullName,
1138
- state
1139
- });
1134
+ for (const mod of projectModules) {
1135
+ const modulePath = mod.relativeModuleId ?? "";
1136
+ for (const testCase of mod.children.allTests()) {
1137
+ const state = testCase.result()?.state;
1138
+ if (state === "passed" || state === "failed") testOutcomes.push({
1139
+ modulePath,
1140
+ fullName: testCase.fullName,
1141
+ state
1142
+ });
1143
+ }
1140
1144
  }
1141
1145
  const { classifications } = yield* tracker.classify(project, testOutcomes, baseReport.timestamp);
1142
1146
  const diagMap = /* @__PURE__ */ new Map();
1143
1147
  const errorMap = /* @__PURE__ */ new Map();
1144
- for (const mod of projectModules) for (const tc of mod.children.allTests()) {
1145
- diagMap.set(tc.fullName, tc.diagnostic() ?? {});
1146
- const tcResult = tc.result();
1147
- if (tcResult?.state === "failed") {
1148
- const errors = tcResult.errors;
1149
- errorMap.set(tc.fullName, errors?.[0]?.message ?? null);
1148
+ for (const mod of projectModules) {
1149
+ const modulePath = mod.relativeModuleId ?? "";
1150
+ for (const tc of mod.children.allTests()) {
1151
+ const key = historyKey(modulePath, tc.fullName);
1152
+ diagMap.set(key, tc.diagnostic() ?? {});
1153
+ const tcResult = tc.result();
1154
+ if (tcResult?.state === "failed") {
1155
+ const errors = tcResult.errors;
1156
+ errorMap.set(key, errors?.[0]?.message ?? null);
1157
+ }
1150
1158
  }
1151
1159
  }
1152
1160
  for (const outcome of testOutcomes) {
1153
- const diag = diagMap.get(outcome.fullName);
1154
- const errorMessage = outcome.state === "failed" ? errorMap.get(outcome.fullName) ?? null : null;
1155
- yield* store.writeHistory(project, outcome.fullName, runId, baseReport.timestamp, outcome.state, diag?.duration ?? null, diag?.flaky ?? false, 0, errorMessage);
1161
+ const key = historyKey(outcome.modulePath, outcome.fullName);
1162
+ const diag = diagMap.get(key);
1163
+ const errorMessage = outcome.state === "failed" ? errorMap.get(key) ?? null : null;
1164
+ yield* store.writeHistory(project, outcome.fullName, outcome.modulePath, runId, baseReport.timestamp, outcome.state, diag?.duration ?? null, diag?.flaky ?? false, 0, errorMessage);
1156
1165
  }
1157
1166
  const failedWithClassifications = baseReport.failed.map((mod) => ({
1158
1167
  ...mod,
1159
1168
  tests: mod.tests.map((test) => {
1160
- const cls = classifications.get(test.fullName);
1169
+ const cls = classifications.get(historyKey(mod.file, test.fullName));
1161
1170
  return cls ? {
1162
1171
  ...test,
1163
1172
  classification: cls