@vitest-agent/sdk 2.5.0 → 3.0.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/dispatch.d.ts +4 -4
- package/index.d.ts +1056 -472
- package/index.js +11 -7
- package/layers/DataReaderLive.js +90 -0
- package/layers/DataStoreLive.js +48 -2
- package/migrations/0002_test_artifacts.js +30 -0
- package/migrations/index.js +26 -0
- package/package.json +12 -11
- package/schemas/CoverageTargets.js +9 -4
- package/schemas/Options.js +20 -4
- package/schemas/RunEvent.js +8 -2
- package/schemas/RunReportFile.js +51 -0
- package/schemas/TestArtifacts.js +74 -0
- package/schemas/Thresholds.js +23 -3
- package/schemas/run-report-file-1.0.0.json +963 -0
- package/services/DataStore.js +8 -1
- package/testing/layers.js +2 -2
- package/testing.d.ts +216 -53
- package/testing.js +5 -4
- package/utils/ensure-migrated.js +2 -2
- package/utils/validate-coverage-targets-shape.js +12 -4
package/testing.js
CHANGED
|
@@ -5,6 +5,7 @@ import { DataReader } from "./services/DataReader.js";
|
|
|
5
5
|
import { AgentId, ChatId } from "./schemas/Identity.js";
|
|
6
6
|
import { Agent, IdempotencyHit } from "./schemas/Agent.js";
|
|
7
7
|
import { DataStore } from "./services/DataStore.js";
|
|
8
|
+
import { PROJECT_MIGRATIONS } from "./migrations/index.js";
|
|
8
9
|
import { CoverageReport, FileCoverageReport } from "./schemas/Coverage.js";
|
|
9
10
|
import { AgentReport } from "./schemas/AgentReport.js";
|
|
10
11
|
import { CoverageBaselines } from "./schemas/Baselines.js";
|
|
@@ -26,7 +27,7 @@ function singlePassingRun(filename) {
|
|
|
26
27
|
const seed = Effect.gen(function* () {
|
|
27
28
|
const store = yield* DataStore;
|
|
28
29
|
yield* store.writeSettings("hash-preset-spr", {
|
|
29
|
-
vitestVersion: "
|
|
30
|
+
vitestVersion: "5.0.0",
|
|
30
31
|
pool: "forks"
|
|
31
32
|
}, {});
|
|
32
33
|
const runId = yield* store.writeRun({
|
|
@@ -80,7 +81,7 @@ function withFailures(filename) {
|
|
|
80
81
|
const seed = Effect.gen(function* () {
|
|
81
82
|
const store = yield* DataStore;
|
|
82
83
|
yield* store.writeSettings("hash-preset-wf", {
|
|
83
|
-
vitestVersion: "
|
|
84
|
+
vitestVersion: "5.0.0",
|
|
84
85
|
pool: "forks"
|
|
85
86
|
}, {});
|
|
86
87
|
const runId = yield* store.writeRun({
|
|
@@ -140,7 +141,7 @@ function flaky(filename) {
|
|
|
140
141
|
const seed = Effect.gen(function* () {
|
|
141
142
|
const store = yield* DataStore;
|
|
142
143
|
yield* store.writeSettings("hash-preset-flaky", {
|
|
143
|
-
vitestVersion: "
|
|
144
|
+
vitestVersion: "5.0.0",
|
|
144
145
|
pool: "forks"
|
|
145
146
|
}, {});
|
|
146
147
|
const runId1 = yield* store.writeRun({
|
|
@@ -250,4 +251,4 @@ function withTddTask(filename) {
|
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
//#endregion
|
|
253
|
-
export { Agent, AgentId, AgentNotFoundError, AgentReport, BehaviorDetail, BehaviorNotFoundError, BehaviorRow, BehaviorStatus, CacheManifest, ChatId, CoverageBaselines, CoverageReport, DataReader, DataStore, DataStoreError, DataStoreTestLayer, FileCoverageReport, GoalDetail, GoalNotFoundError, GoalRow, GoalStatus, HistoryRecord, IdempotencyHit, IllegalStatusTransitionError, RegistrationConflictError, TddTaskAlreadyEndedError, TddTaskNotFoundError, TrendEntry, TrendRecord, empty, flaky, makeTestLayer, singlePassingRun, withFailures, withTddTask };
|
|
254
|
+
export { Agent, AgentId, AgentNotFoundError, AgentReport, BehaviorDetail, BehaviorNotFoundError, BehaviorRow, BehaviorStatus, CacheManifest, ChatId, CoverageBaselines, CoverageReport, DataReader, DataStore, DataStoreError, DataStoreTestLayer, FileCoverageReport, GoalDetail, GoalNotFoundError, GoalRow, GoalStatus, HistoryRecord, IdempotencyHit, IllegalStatusTransitionError, PROJECT_MIGRATIONS, RegistrationConflictError, TddTaskAlreadyEndedError, TddTaskNotFoundError, TrendEntry, TrendRecord, empty, flaky, makeTestLayer, singlePassingRun, withFailures, withTddTask };
|
package/utils/ensure-migrated.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LoggerLive } from "../layers/LoggerLive.js";
|
|
2
|
-
import
|
|
2
|
+
import { PROJECT_MIGRATIONS } from "../migrations/index.js";
|
|
3
3
|
import { Effect, Layer } from "effect";
|
|
4
4
|
import { SqlClient } from "effect/unstable/sql/SqlClient";
|
|
5
5
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
@@ -30,7 +30,7 @@ function ensureMigrated(dbPath, logLevel, logFile) {
|
|
|
30
30
|
if (cached) return cached;
|
|
31
31
|
const SqliteLayer = layer({ filename: dbPath });
|
|
32
32
|
const PlatformLayer = NodeServices.layer;
|
|
33
|
-
const MigratorLayer = SqliteMigrator.layer({ loader: SqliteMigrator.fromRecord(
|
|
33
|
+
const MigratorLayer = SqliteMigrator.layer({ loader: SqliteMigrator.fromRecord(PROJECT_MIGRATIONS) }).pipe(Layer.provide(Layer.merge(SqliteLayer, PlatformLayer)));
|
|
34
34
|
const program = Effect.gen(function* () {
|
|
35
35
|
yield* SqlClient;
|
|
36
36
|
}).pipe(Effect.provide(MigratorLayer), Effect.provide(Layer.merge(SqliteLayer, PlatformLayer)), Effect.provide(LoggerLive(logLevel, logFile)));
|
|
@@ -24,9 +24,15 @@ function checkBooleanShortcut(key, path, errors) {
|
|
|
24
24
|
message: `Coverage target at "${path}" cannot be true. The "true" shorthand is only valid at key "100" (meaning 100% across all metrics).`
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Checks all values inside a nested per-metric object (glob-pattern entry).
|
|
29
|
+
* `perFile` is a legal key inside a glob entry under Vitest 5 — a glob entry
|
|
30
|
+
* no longer inherits the top-level setting — so it is skipped here rather
|
|
31
|
+
* than run through the boolean-shortcut check.
|
|
32
|
+
*/
|
|
28
33
|
function checkNestedMetrics(nested, prefix, errors) {
|
|
29
34
|
for (const [metricKey, metricValue] of Object.entries(nested)) {
|
|
35
|
+
if (metricKey === "perFile") continue;
|
|
30
36
|
const path = `${prefix}.${metricKey}`;
|
|
31
37
|
if (typeof metricValue === "number") checkNumericValue(metricValue, path, errors);
|
|
32
38
|
else if (metricValue === true) checkBooleanShortcut(metricKey, path, errors);
|
|
@@ -41,8 +47,10 @@ function checkNestedMetrics(nested, prefix, errors) {
|
|
|
41
47
|
* OR a literal `true` appears at any key other than `"100"`. The
|
|
42
48
|
* offending `path` is included (e.g. `"lines"`, `"src/**.ts.lines"`,
|
|
43
49
|
* or `"statements"` when misused as a boolean shortcut).
|
|
44
|
-
* - `PERFILE_ON_TARGETS` —
|
|
45
|
-
*
|
|
50
|
+
* - `PERFILE_ON_TARGETS` — a top-level `perFile` key appears in
|
|
51
|
+
* coverageTargets; the top-level setting belongs on
|
|
52
|
+
* `coverage.thresholds.perFile`. A `perFile` inside a glob-pattern entry
|
|
53
|
+
* is legal and is not reported.
|
|
46
54
|
*
|
|
47
55
|
* @param input - The raw value passed as coverageTargets.
|
|
48
56
|
* @returns A result object with errors, warnings, and info arrays.
|
|
@@ -62,7 +70,7 @@ function validateCoverageTargetsShape(input) {
|
|
|
62
70
|
warnings.push({
|
|
63
71
|
code: "PERFILE_ON_TARGETS",
|
|
64
72
|
path: key,
|
|
65
|
-
message: "
|
|
73
|
+
message: "A top-level \"perFile\" key is not valid inside coverageTargets. Set coverage.thresholds.perFile instead, or move it inside a glob-pattern entry — under Vitest 5 a glob-pattern entry carries its own perFile and no longer inherits the top-level one."
|
|
66
74
|
});
|
|
67
75
|
continue;
|
|
68
76
|
}
|