@vitest-agent/sdk 1.3.4 → 2.0.1

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 (58) hide show
  1. package/errors/DataStoreError.js +22 -13
  2. package/index.d.ts +1032 -1101
  3. package/index.js +3 -3
  4. package/layers/ConfigLive.js +8 -9
  5. package/layers/DataReaderLive.js +2 -2
  6. package/layers/DataStoreLive.js +2 -2
  7. package/layers/DiscoveryRegistryLive.js +1 -1
  8. package/layers/LoggerLive.js +24 -24
  9. package/layers/PathResolutionLive.js +18 -17
  10. package/layers/PerClientSessionMapLive.js +1 -1
  11. package/layers/ProjectDiscoveryLive.js +1 -2
  12. package/layers/ProjectIdentityLive.js +16 -12
  13. package/layers/RunContextLive.js +20 -20
  14. package/migrations/0001_initial.js +1 -1
  15. package/migrations/registry_0001_initial.js +1 -1
  16. package/migrations/session_map_0001_initial.js +1 -1
  17. package/package.json +18 -18
  18. package/schemas/AgentReport.js +6 -9
  19. package/schemas/Baselines.js +3 -3
  20. package/schemas/CacheManifest.js +2 -2
  21. package/schemas/ChannelEvent.js +30 -3
  22. package/schemas/Common.js +76 -14
  23. package/schemas/ConsoleLeaks.js +2 -2
  24. package/schemas/Coverage.js +8 -8
  25. package/schemas/CoverageTargets.js +16 -10
  26. package/schemas/History.js +4 -4
  27. package/schemas/Identity.js +19 -7
  28. package/schemas/Options.js +3 -3
  29. package/schemas/RenderState.js +26 -19
  30. package/schemas/RunEvent.js +154 -115
  31. package/schemas/Tdd.js +16 -6
  32. package/schemas/Thresholds.js +6 -6
  33. package/schemas/Transport.js +1 -1
  34. package/schemas/Trends.js +7 -3
  35. package/schemas/turns/FileEditPayload.js +5 -1
  36. package/schemas/turns/HookFirePayload.js +15 -1
  37. package/schemas/turns/index.js +9 -1
  38. package/services/Config.js +3 -3
  39. package/services/DataReader.js +1 -1
  40. package/services/DataStore.js +1 -1
  41. package/services/DetailResolver.js +1 -1
  42. package/services/DiscoveryRegistry.js +1 -1
  43. package/services/EnvironmentDetector.js +1 -1
  44. package/services/ExecutorResolver.js +1 -1
  45. package/services/FormatSelector.js +1 -1
  46. package/services/HistoryTracker.js +1 -1
  47. package/services/OutputRenderer.js +1 -1
  48. package/services/PerClientSessionMap.js +2 -2
  49. package/services/ProjectDiscovery.js +1 -1
  50. package/services/ProjectIdentity.js +1 -1
  51. package/services/RunContext.js +1 -1
  52. package/testing/layers.js +2 -2
  53. package/testing.d.ts +312 -332
  54. package/tsdoc-metadata.json +1 -1
  55. package/utils/build-report.js +16 -1
  56. package/utils/ensure-migrated.js +3 -3
  57. package/utils/resolve-data-path.js +3 -3
  58. package/utils/resolve-workspace-key.js +11 -6
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.58.9"
8
+ "packageVersion": "7.58.11"
9
9
  }
10
10
  ]
11
11
  }
@@ -125,6 +125,21 @@ function buildAgentReport(testModules, unhandledErrors, reason, options, project
125
125
  failedFiles
126
126
  };
127
127
  }
128
+ /**
129
+ * Count suite-level (collection/load) failures in a report.
130
+ *
131
+ * A collection failure is a module that failed before any test case could
132
+ * run — an import error, a top-level throw, a syntax error. Such a module
133
+ * lands in `report.failed` with no failed test case, so it contributes
134
+ * nothing to `summary.failed` (which stays tied to test cases). Renderers
135
+ * and the plugin's `hasFailures` health check add this count so a suite that
136
+ * never loaded surfaces instead of showing a misleading all-green result.
137
+ *
138
+ * @param report - the report to inspect
139
+ * @returns the number of modules in `report.failed` with no failed test case
140
+ * @public
141
+ */
142
+ const countSuiteFailures = (report) => report.failed.filter((mod) => !mod.tests.some((test) => test.state === "failed")).length;
128
143
 
129
144
  //#endregion
130
- export { buildAgentReport };
145
+ export { buildAgentReport, countSuiteFailures };
@@ -1,8 +1,8 @@
1
1
  import { LoggerLive } from "../layers/LoggerLive.js";
2
2
  import migration from "../migrations/0001_initial.js";
3
3
  import { Effect, Layer } from "effect";
4
- import { SqlClient } from "@effect/sql/SqlClient";
5
- import * as NodeContext from "@effect/platform-node/NodeContext";
4
+ import { SqlClient } from "effect/unstable/sql/SqlClient";
5
+ import * as NodeServices from "@effect/platform-node/NodeServices";
6
6
  import { layer } from "@effect/sql-sqlite-node/SqliteClient";
7
7
  import * as SqliteMigrator from "@effect/sql-sqlite-node/SqliteMigrator";
8
8
 
@@ -29,7 +29,7 @@ function ensureMigrated(dbPath, logLevel, logFile) {
29
29
  const cached = cache.get(dbPath);
30
30
  if (cached) return cached;
31
31
  const SqliteLayer = layer({ filename: dbPath });
32
- const PlatformLayer = NodeContext.layer;
32
+ const PlatformLayer = NodeServices.layer;
33
33
  const MigratorLayer = SqliteMigrator.layer({ loader: SqliteMigrator.fromRecord({ "0001_initial": migration }) }).pipe(Layer.provide(Layer.merge(SqliteLayer, PlatformLayer)));
34
34
  const program = Effect.gen(function* () {
35
35
  yield* SqlClient;
@@ -5,7 +5,7 @@ import { resolveProjectKeyFromCwd } from "./resolve-project-key-from-cwd.js";
5
5
  import { Effect } from "effect";
6
6
  import { join } from "node:path";
7
7
  import { mkdirSync } from "node:fs";
8
- import { AppDirs } from "xdg-effect";
8
+ import { AppDirs } from "@effected/xdg";
9
9
 
10
10
  //#region src/utils/resolve-data-path.ts
11
11
  /**
@@ -18,8 +18,8 @@ const DATABASE_FILENAME = "data.db";
18
18
  *
19
19
  * The directory containing the database is ensured to exist before the
20
20
  * function returns, so callers can open the database immediately without
21
- * needing to create parent directories. better-sqlite3 creates the file but
22
- * not its parent.
21
+ * needing to create parent directories. The SQLite driver creates the file
22
+ * but not its parent.
23
23
  *
24
24
  * Precedence (highest first):
25
25
  *
@@ -1,6 +1,6 @@
1
1
  import { normalizeWorkspaceKey } from "./normalize-workspace-key.js";
2
2
  import { Effect } from "effect";
3
- import { WorkspaceDiscovery, WorkspaceRootNotFoundError } from "workspaces-effect";
3
+ import { WorkspaceDiscovery, WorkspaceRootNotFoundError } from "@effected/workspaces";
4
4
 
5
5
  //#region src/utils/resolve-workspace-key.ts
6
6
  /**
@@ -12,19 +12,24 @@ import { WorkspaceDiscovery, WorkspaceRootNotFoundError } from "workspaces-effec
12
12
  * `$XDG_DATA_HOME/vitest-agent/` where the SQLite database lives.
13
13
  *
14
14
  * Fails with `WorkspaceRootNotFoundError` when no root workspace is
15
- * discoverable from `projectDir`. `WorkspacePackage.name` is enforced
16
- * non-empty by `workspaces-effect`'s schema, so a successful root lookup
17
- * always yields a usable name.
15
+ * discoverable. `WorkspacePackage.name` is enforced non-empty by
16
+ * `@effected/workspaces`'s schema, so a successful root lookup always yields a
17
+ * usable name.
18
+ *
19
+ * Note (v4): `@effected/workspaces` anchors discovery at the `WorkspaceDiscovery`
20
+ * layer's `cwd`, not at a per-call path — `discovery.listPackages()` takes no
21
+ * argument. `projectDir` is retained for the not-found diagnostic; callers that
22
+ * need to anchor at a specific directory build `WorkspaceDiscovery.layer({ cwd })`.
18
23
  *
19
24
  * @param projectDir - Absolute path inside the workspace. Typically the
20
25
  * reporter's resolved `projectDir` (CLAUDE_PROJECT_DIR or process.cwd()).
21
26
  * @public
22
27
  */
23
28
  const resolveWorkspaceKey = (projectDir) => Effect.gen(function* () {
24
- const root = (yield* (yield* WorkspaceDiscovery).listPackages(projectDir)).find((pkg) => pkg.isRootWorkspace);
29
+ const root = (yield* (yield* WorkspaceDiscovery).listPackages()).find((pkg) => pkg.isRootWorkspace);
25
30
  if (!root) return yield* Effect.fail(new WorkspaceRootNotFoundError({
26
31
  searchPath: projectDir,
27
- reason: "No root workspace package found in the discovered package list."
32
+ markers: []
28
33
  }));
29
34
  return normalizeWorkspaceKey(root.name);
30
35
  });