@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.
- package/errors/DataStoreError.js +22 -13
- package/index.d.ts +1032 -1101
- package/index.js +3 -3
- package/layers/ConfigLive.js +8 -9
- package/layers/DataReaderLive.js +2 -2
- package/layers/DataStoreLive.js +2 -2
- package/layers/DiscoveryRegistryLive.js +1 -1
- package/layers/LoggerLive.js +24 -24
- package/layers/PathResolutionLive.js +18 -17
- package/layers/PerClientSessionMapLive.js +1 -1
- package/layers/ProjectDiscoveryLive.js +1 -2
- package/layers/ProjectIdentityLive.js +16 -12
- package/layers/RunContextLive.js +20 -20
- package/migrations/0001_initial.js +1 -1
- package/migrations/registry_0001_initial.js +1 -1
- package/migrations/session_map_0001_initial.js +1 -1
- package/package.json +18 -18
- package/schemas/AgentReport.js +6 -9
- package/schemas/Baselines.js +3 -3
- package/schemas/CacheManifest.js +2 -2
- package/schemas/ChannelEvent.js +30 -3
- package/schemas/Common.js +76 -14
- package/schemas/ConsoleLeaks.js +2 -2
- package/schemas/Coverage.js +8 -8
- package/schemas/CoverageTargets.js +16 -10
- package/schemas/History.js +4 -4
- package/schemas/Identity.js +19 -7
- package/schemas/Options.js +3 -3
- package/schemas/RenderState.js +26 -19
- package/schemas/RunEvent.js +154 -115
- package/schemas/Tdd.js +16 -6
- package/schemas/Thresholds.js +6 -6
- package/schemas/Transport.js +1 -1
- package/schemas/Trends.js +7 -3
- package/schemas/turns/FileEditPayload.js +5 -1
- package/schemas/turns/HookFirePayload.js +15 -1
- package/schemas/turns/index.js +9 -1
- package/services/Config.js +3 -3
- package/services/DataReader.js +1 -1
- package/services/DataStore.js +1 -1
- package/services/DetailResolver.js +1 -1
- package/services/DiscoveryRegistry.js +1 -1
- package/services/EnvironmentDetector.js +1 -1
- package/services/ExecutorResolver.js +1 -1
- package/services/FormatSelector.js +1 -1
- package/services/HistoryTracker.js +1 -1
- package/services/OutputRenderer.js +1 -1
- package/services/PerClientSessionMap.js +2 -2
- package/services/ProjectDiscovery.js +1 -1
- package/services/ProjectIdentity.js +1 -1
- package/services/RunContext.js +1 -1
- package/testing/layers.js +2 -2
- package/testing.d.ts +312 -332
- package/tsdoc-metadata.json +1 -1
- package/utils/build-report.js +16 -1
- package/utils/ensure-migrated.js +3 -3
- package/utils/resolve-data-path.js +3 -3
- package/utils/resolve-workspace-key.js +11 -6
package/tsdoc-metadata.json
CHANGED
package/utils/build-report.js
CHANGED
|
@@ -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 };
|
package/utils/ensure-migrated.js
CHANGED
|
@@ -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 "
|
|
5
|
-
import * as
|
|
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 =
|
|
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
|
|
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.
|
|
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
|
|
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
|
|
16
|
-
*
|
|
17
|
-
*
|
|
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(
|
|
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
|
-
|
|
32
|
+
markers: []
|
|
28
33
|
}));
|
|
29
34
|
return normalizeWorkspaceKey(root.name);
|
|
30
35
|
});
|