@vitest-agent/sdk 7.0.4 → 7.1.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 +0 -6
- package/errors/AgentErrors.js +1 -2
- package/errors/DataStoreError.js +1 -2
- package/errors/DiscoveryError.js +1 -2
- package/errors/PathResolutionError.js +1 -2
- package/errors/ProjectIdentityError.js +1 -2
- package/errors/RunContextError.js +1 -2
- package/errors/TddErrors.js +1 -2
- package/exit-code-for-tag.js +1 -2
- package/index.d.ts +108 -141
- package/index.js +2 -2
- package/internal-inject-env.js +1 -2
- package/package.json +2 -2
- package/schemas/5.0/run.json +75 -135
- package/schemas/Agent.js +1 -2
- package/schemas/AgentReport.js +1 -2
- package/schemas/Baselines.js +1 -2
- package/schemas/CacheManifest.js +1 -2
- package/schemas/ChannelEvent.js +1 -2
- package/schemas/Common.js +1 -2
- package/schemas/Config.js +73 -7
- package/schemas/ConsoleLeaks.js +1 -2
- package/schemas/Coverage.js +1 -2
- package/schemas/CoverageLevel.js +1 -2
- package/schemas/CoverageTargets.js +1 -2
- package/schemas/History.js +1 -2
- package/schemas/Identity.js +1 -2
- package/schemas/Options.js +32 -5
- package/schemas/RenderState.js +1 -2
- package/schemas/RunEvent.js +1 -2
- package/schemas/RunReportFile.js +1 -2
- package/schemas/StrayOutput.js +1 -2
- package/schemas/Tdd.js +1 -2
- package/schemas/TestArtifacts.js +1 -2
- package/schemas/Thresholds.js +1 -2
- package/schemas/Transport.js +1 -2
- package/schemas/Trends.js +1 -2
- package/schemas/turns/FileEditPayload.js +1 -2
- package/schemas/turns/HookFirePayload.js +1 -2
- package/schemas/turns/HypothesisPayload.js +1 -2
- package/schemas/turns/NotePayload.js +1 -2
- package/schemas/turns/ToolCallPayload.js +1 -2
- package/schemas/turns/ToolResultPayload.js +1 -2
- package/schemas/turns/UserPromptPayload.js +1 -2
- package/schemas/turns/index.js +1 -2
- package/sidecar-dispatch.js +1 -2
- package/utils/ansi.js +1 -2
- package/utils/build-report.js +1 -2
- package/utils/canonicalize-git-url.js +1 -2
- package/utils/classify-test.js +1 -2
- package/utils/coerce-error-text.js +1 -2
- package/utils/compress-lines.js +1 -2
- package/utils/compute-trend.js +1 -2
- package/utils/console-leaks.js +1 -2
- package/utils/detect-non-default-discover-strategy.js +1 -2
- package/utils/detect-pm.js +1 -2
- package/utils/detect-timeout.js +1 -2
- package/utils/format-console.js +1 -2
- package/utils/format-fatal-error.js +1 -2
- package/utils/format-gfm.js +1 -2
- package/utils/format-scoped-coverage-note.js +1 -2
- package/utils/function-boundary.js +1 -2
- package/utils/hyperlink.js +1 -2
- package/utils/match-vitest-command.js +1 -2
- package/utils/normalize-workspace-key.js +1 -2
- package/utils/posix-path.js +1 -2
- package/utils/probe-host-metadata.js +1 -2
- package/utils/safe-filename.js +1 -2
- package/utils/stray-output.js +1 -2
- package/utils/test-location.js +1 -2
- package/utils/validate-coverage-targets-shape.js +1 -2
- package/utils/validate-phase-transition.js +1 -2
- package/version.js +2 -3
package/schemas/Options.js
CHANGED
|
@@ -3,7 +3,7 @@ import { CoverageTargets } from "./CoverageTargets.js";
|
|
|
3
3
|
import { Transport } from "./Transport.js";
|
|
4
4
|
import { Schema } from "effect";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/schemas/Options.ts
|
|
7
7
|
/**
|
|
8
8
|
* Per-executor console-output matrix. Most users never set this — the
|
|
9
9
|
* built-in defaults cover the common cases. Override per slot when you
|
|
@@ -42,17 +42,45 @@ const ReportOption = Schema.Union([Schema.Literal(false), ReportSettings]).annot
|
|
|
42
42
|
/**
|
|
43
43
|
* The 2.0 user-facing options for `AgentPlugin`.
|
|
44
44
|
*
|
|
45
|
-
*
|
|
45
|
+
* Seven fields total. Two are function-typed (`reporter`, `onRunEvent`)
|
|
46
46
|
* and live on the `AgentPluginConstructorOptions` companion interface in
|
|
47
47
|
* `@vitest-agent/plugin` — Effect Schema cannot encode functions cleanly,
|
|
48
|
-
* so the schema-decodable struct carries the
|
|
48
|
+
* so the schema-decodable struct carries the five data-shaped fields.
|
|
49
49
|
* @public
|
|
50
50
|
*/
|
|
51
51
|
const AgentPluginOptions = Schema.Struct({
|
|
52
52
|
console: Schema.optional(ConsoleOutputs),
|
|
53
53
|
coverageTargets: Schema.optional(CoverageTargets),
|
|
54
54
|
transport: Schema.optional(Transport),
|
|
55
|
-
report: Schema.optional(ReportOption)
|
|
55
|
+
report: Schema.optional(ReportOption),
|
|
56
|
+
/**
|
|
57
|
+
* Whether a run is recorded in the SQLite `data.db` (default `true`).
|
|
58
|
+
*
|
|
59
|
+
* `false` is the explicit opt-out for a runner where nothing reads the
|
|
60
|
+
* database back — a throwaway CI job, say. The run still renders every
|
|
61
|
+
* console and report-file output, still emits every `RunEvent`, and
|
|
62
|
+
* Vitest still enforces `coverage.thresholds` through its own
|
|
63
|
+
* mechanism; only the database writes are skipped: run rows, test
|
|
64
|
+
* cases, failure history, coverage rows and trends, and the baselines
|
|
65
|
+
* they feed. Consequences a renderer sees: failure classifications are
|
|
66
|
+
* empty (there is no history to classify against, so no test is
|
|
67
|
+
* labelled `stable`, `new-failure`, `persistent`, `flaky` or
|
|
68
|
+
* `recovered`), and coverage renders without a baseline delta or a
|
|
69
|
+
* trend line. The `data.db` file is never created or opened.
|
|
70
|
+
*
|
|
71
|
+
* The opt-out is never automatic: `CI=true` does not imply it, because
|
|
72
|
+
* some CI setups cache `data.db` between jobs and query it. The
|
|
73
|
+
* `VITEST_AGENT_PERSIST` environment variable (`0` / `false` / `off`
|
|
74
|
+
* to disable, `1` / `true` / `on` to enable) is the operator spelling
|
|
75
|
+
* for a runner whose config cannot be edited, and it wins over this
|
|
76
|
+
* option in either direction; any other value is ignored with one
|
|
77
|
+
* stderr line.
|
|
78
|
+
*
|
|
79
|
+
* `coverage.enabled: false` in Vitest's own config already skips
|
|
80
|
+
* persistence (UI-only mode, Decision 38) — this option is for a run
|
|
81
|
+
* that keeps coverage on and still wants no database.
|
|
82
|
+
*/
|
|
83
|
+
persist: Schema.optional(Schema.Boolean)
|
|
56
84
|
}).annotate({ identifier: "AgentPluginOptions" });
|
|
57
85
|
/**
|
|
58
86
|
* Reporter-implementation options.
|
|
@@ -69,5 +97,4 @@ const AgentReporterOptions = Schema.Struct({
|
|
|
69
97
|
/** Set by the plugin per-project. Filters reports to one project. */
|
|
70
98
|
projectFilter: Schema.optional(Schema.String) }).annotate({ identifier: "AgentReporterOptions" });
|
|
71
99
|
|
|
72
|
-
//#endregion
|
|
73
100
|
export { AgentPluginOptions, AgentReporterOptions, ConsoleOutputs, ReportOption, ReportSettings };
|
package/schemas/RenderState.js
CHANGED
|
@@ -5,7 +5,7 @@ import { StrayOutput } from "./StrayOutput.js";
|
|
|
5
5
|
import { ActionSeverity, CoverageGap, CoverageMetric } from "./RunEvent.js";
|
|
6
6
|
import { Schema } from "effect";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/schemas/RenderState.ts
|
|
9
9
|
/**
|
|
10
10
|
* Per-test record accumulated as `TestStarted` / `TestFinished` events arrive.
|
|
11
11
|
* @public
|
|
@@ -193,5 +193,4 @@ const initialRenderState = {
|
|
|
193
193
|
unhandledErrors: []
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
-
//#endregion
|
|
197
196
|
export { CoverageRenderState, FailureRecord, ModuleRecord, RenderState, RenderTotals, SuggestedActionRecord, TestRecord, initialRenderState };
|
package/schemas/RunEvent.js
CHANGED
|
@@ -5,7 +5,7 @@ import { StrayOutput } from "./StrayOutput.js";
|
|
|
5
5
|
import { TestArtifactLocation, TestAttachment } from "./TestArtifacts.js";
|
|
6
6
|
import { Schema } from "effect";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/schemas/RunEvent.ts
|
|
9
9
|
/**
|
|
10
10
|
* Coverage metric whose threshold can be violated independently.
|
|
11
11
|
* @public
|
|
@@ -230,5 +230,4 @@ const RunEvent = Schema.Union([
|
|
|
230
230
|
})
|
|
231
231
|
]).annotate({ identifier: "RunEvent" });
|
|
232
232
|
|
|
233
|
-
//#endregion
|
|
234
233
|
export { ActionSeverity, ConsoleLogLevel, FileCoverageReport as CoverageFile, CoverageGap, CoverageMetric, HookStatus, HookType, RunEvent };
|
package/schemas/RunReportFile.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AgentReport } from "./AgentReport.js";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/schemas/RunReportFile.ts
|
|
5
5
|
/**
|
|
6
6
|
* The `.vitest/vitest-agent/run.json` file contract.
|
|
7
7
|
*
|
|
@@ -53,5 +53,4 @@ const RunReportFile = Schema.Struct({
|
|
|
53
53
|
description: "The vitest-agent run report file (.vitest/vitest-agent/run.json): one AgentReport per Vitest project from the most recent run. Read reports[].summary for pass/fail counts and reports[].failed for the failing modules and their tests. schemaVersion is the envelope contract version; generatedAt is when the run finished."
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
//#endregion
|
|
57
56
|
export { RUN_REPORT_FILE_SCHEMA_URL, RunReportFile };
|
package/schemas/StrayOutput.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/schemas/StrayOutput.ts
|
|
4
4
|
/**
|
|
5
5
|
* One line of stray output, kept as a sample: the stream it was written to,
|
|
6
6
|
* and its text with escapes stripped, cut to a sane length.
|
|
@@ -34,5 +34,4 @@ const StrayOutput = Schema.Struct({
|
|
|
34
34
|
samples: Schema.Array(StrayOutputSample)
|
|
35
35
|
}).annotate({ identifier: "StrayOutput" });
|
|
36
36
|
|
|
37
|
-
//#endregion
|
|
38
37
|
export { StrayOutput, StrayOutputSample };
|
package/schemas/Tdd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/schemas/Tdd.ts
|
|
4
4
|
/** @public */
|
|
5
5
|
const GoalStatus = Schema.Literals([
|
|
6
6
|
"pending",
|
|
@@ -50,5 +50,4 @@ const BehaviorDetail = Schema.Struct({
|
|
|
50
50
|
dependencies: Schema.Array(BehaviorRow)
|
|
51
51
|
}).annotate({ identifier: "BehaviorDetail" });
|
|
52
52
|
|
|
53
|
-
//#endregion
|
|
54
53
|
export { BehaviorDetail, BehaviorRow, BehaviorStatus, GoalDetail, GoalRow, GoalStatus };
|
package/schemas/TestArtifacts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/schemas/TestArtifacts.ts
|
|
4
4
|
/**
|
|
5
5
|
* Schemas for Vitest 5 test annotations and test artifacts.
|
|
6
6
|
*
|
|
@@ -70,5 +70,4 @@ const TestArtifact = Schema.Struct({
|
|
|
70
70
|
attachments: Schema.Array(TestAttachment)
|
|
71
71
|
}).annotate({ identifier: "TestArtifact" });
|
|
72
72
|
|
|
73
|
-
//#endregion
|
|
74
73
|
export { TestAnnotation, TestArtifact, TestArtifactLocation, TestAttachment };
|
package/schemas/Thresholds.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/schemas/Thresholds.ts
|
|
4
4
|
/**
|
|
5
5
|
* Per-metric threshold values. All optional -- only set metrics are enforced.
|
|
6
6
|
* @public
|
|
@@ -46,5 +46,4 @@ const ResolvedThresholds = Schema.Struct({
|
|
|
46
46
|
patterns: Schema.Array(PatternThresholds).pipe(Schema.withDecodingDefaultKey(Effect.succeed([])))
|
|
47
47
|
}).annotate({ identifier: "ResolvedThresholds" });
|
|
48
48
|
|
|
49
|
-
//#endregion
|
|
50
49
|
export { MetricThresholds, PatternMetricThresholds, PatternThresholds, PerFileThresholds, ResolvedThresholds };
|
package/schemas/Transport.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/schemas/Transport.ts
|
|
4
4
|
/**
|
|
5
5
|
* Transport binding for the persistence layer.
|
|
6
6
|
*
|
|
@@ -12,5 +12,4 @@ import { Schema } from "effect";
|
|
|
12
12
|
*/
|
|
13
13
|
const Transport = Schema.Union([Schema.Struct({ kind: Schema.Literal("local") })]).annotate({ identifier: "Transport" });
|
|
14
14
|
|
|
15
|
-
//#endregion
|
|
16
15
|
export { Transport };
|
package/schemas/Trends.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CoverageTotals } from "./Coverage.js";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/schemas/Trends.ts
|
|
5
5
|
/**
|
|
6
6
|
* A single coverage trend data point recorded on a full test run.
|
|
7
7
|
* @public
|
|
@@ -23,5 +23,4 @@ const TrendEntry = Schema.Struct({
|
|
|
23
23
|
*/
|
|
24
24
|
const TrendRecord = Schema.Struct({ entries: Schema.Array(TrendEntry) }).annotate({ identifier: "TrendRecord" });
|
|
25
25
|
|
|
26
|
-
//#endregion
|
|
27
26
|
export { TrendEntry, TrendRecord };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/schemas/turns/FileEditPayload.ts
|
|
4
4
|
/** @public */
|
|
5
5
|
const FileEditPayload = Schema.Struct({
|
|
6
6
|
type: Schema.Literal("file_edit"),
|
|
@@ -15,5 +15,4 @@ const FileEditPayload = Schema.Struct({
|
|
|
15
15
|
diff: Schema.optional(Schema.String)
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
//#endregion
|
|
19
18
|
export { FileEditPayload };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/schemas/turns/HookFirePayload.ts
|
|
4
4
|
/** @public */
|
|
5
5
|
const HookFirePayload = Schema.Struct({
|
|
6
6
|
type: Schema.Literal("hook_fire"),
|
|
@@ -23,5 +23,4 @@ const HookFirePayload = Schema.Struct({
|
|
|
23
23
|
previous_record_failures: Schema.optional(Schema.Array(Schema.String))
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
//#endregion
|
|
27
26
|
export { HookFirePayload };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/schemas/turns/HypothesisPayload.ts
|
|
4
4
|
/** @public */
|
|
5
5
|
const HypothesisPayload = Schema.Struct({
|
|
6
6
|
type: Schema.Literal("hypothesis"),
|
|
@@ -9,5 +9,4 @@ const HypothesisPayload = Schema.Struct({
|
|
|
9
9
|
cited_stack_frame_id: Schema.optional(Schema.Number)
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
//#endregion
|
|
13
12
|
export { HypothesisPayload };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/schemas/turns/NotePayload.ts
|
|
4
4
|
/** @public */
|
|
5
5
|
const NotePayload = Schema.Struct({
|
|
6
6
|
type: Schema.Literal("note"),
|
|
@@ -9,5 +9,4 @@ const NotePayload = Schema.Struct({
|
|
|
9
9
|
content: Schema.String
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
//#endregion
|
|
13
12
|
export { NotePayload };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/schemas/turns/ToolCallPayload.ts
|
|
4
4
|
/** @public */
|
|
5
5
|
const ToolCallPayload = Schema.Struct({
|
|
6
6
|
type: Schema.Literal("tool_call"),
|
|
@@ -9,5 +9,4 @@ const ToolCallPayload = Schema.Struct({
|
|
|
9
9
|
tool_use_id: Schema.optional(Schema.String)
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
//#endregion
|
|
13
12
|
export { ToolCallPayload };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/schemas/turns/ToolResultPayload.ts
|
|
4
4
|
/** @public */
|
|
5
5
|
const ToolResultPayload = Schema.Struct({
|
|
6
6
|
type: Schema.Literal("tool_result"),
|
|
@@ -11,5 +11,4 @@ const ToolResultPayload = Schema.Struct({
|
|
|
11
11
|
duration_ms: Schema.optional(Schema.Number)
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
//#endregion
|
|
15
14
|
export { ToolResultPayload };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/schemas/turns/UserPromptPayload.ts
|
|
4
4
|
/** @public */
|
|
5
5
|
const UserPromptPayload = Schema.Struct({
|
|
6
6
|
type: Schema.Literal("user_prompt"),
|
|
@@ -8,5 +8,4 @@ const UserPromptPayload = Schema.Struct({
|
|
|
8
8
|
cc_message_id: Schema.optional(Schema.String)
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
//#endregion
|
|
12
11
|
export { UserPromptPayload };
|
package/schemas/turns/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { ToolResultPayload } from "./ToolResultPayload.js";
|
|
|
7
7
|
import { UserPromptPayload } from "./UserPromptPayload.js";
|
|
8
8
|
import { Schema } from "effect";
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// src/schemas/turns/index.ts
|
|
11
11
|
/** @public */
|
|
12
12
|
const TurnPayload = Schema.Union([
|
|
13
13
|
UserPromptPayload,
|
|
@@ -19,5 +19,4 @@ const TurnPayload = Schema.Union([
|
|
|
19
19
|
HypothesisPayload
|
|
20
20
|
]);
|
|
21
21
|
|
|
22
|
-
//#endregion
|
|
23
22
|
export { FileEditPayload, HookFirePayload, HypothesisPayload, NotePayload, ToolCallPayload, ToolResultPayload, TurnPayload, UserPromptPayload };
|
package/sidecar-dispatch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { exitCodeForTag } from "./exit-code-for-tag.js";
|
|
2
2
|
import { injectEnv } from "./internal-inject-env.js";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/sidecar-dispatch.ts
|
|
5
5
|
/**
|
|
6
6
|
* Parse `--flag value` pairs from an argv slice into a plain record.
|
|
7
7
|
* Bare tokens and unknown shapes are ignored — the subcommand handlers
|
|
@@ -82,5 +82,4 @@ const dispatch = async (argv, io) => {
|
|
|
82
82
|
};
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
-
//#endregion
|
|
86
85
|
export { dispatch };
|
package/utils/ansi.js
CHANGED
package/utils/build-report.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { coerceErrorField } from "./coerce-error-text.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/utils/build-report.ts
|
|
4
4
|
/**
|
|
5
5
|
* Format a single Vitest stack frame: strings pass through; ParsedStack
|
|
6
6
|
* objects render as `at <method> (<file>:<line>:<column>)`. An empty
|
|
@@ -167,5 +167,4 @@ function buildAgentReport(testModules, unhandledErrors, reason, options, project
|
|
|
167
167
|
*/
|
|
168
168
|
const countSuiteFailures = (report) => report.failed.filter((mod) => !mod.tests.some((test) => test.state === "failed")).length;
|
|
169
169
|
|
|
170
|
-
//#endregion
|
|
171
170
|
export { buildAgentReport, countSuiteFailures };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/canonicalize-git-url.ts
|
|
2
2
|
const SCHEME_PREFIXES = [
|
|
3
3
|
"git+ssh://",
|
|
4
4
|
"git+https://",
|
|
@@ -62,5 +62,4 @@ const gitUrlToProjectKey = (raw) => {
|
|
|
62
62
|
return canonical.replaceAll("/", "__");
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
//#endregion
|
|
66
65
|
export { canonicalizeGitUrl, gitUrlToProjectKey };
|
package/utils/classify-test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/classify-test.ts
|
|
2
2
|
/**
|
|
3
3
|
* Classify a test based on its current state and prior run history.
|
|
4
4
|
*
|
|
@@ -18,5 +18,4 @@ function classifyTest(current, priorRuns) {
|
|
|
18
18
|
return priorRuns.some((r) => r.state === "failed") ? "recovered" : "stable";
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
//#endregion
|
|
22
21
|
export { classifyTest };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/coerce-error-text.ts
|
|
2
2
|
/**
|
|
3
3
|
* Coerce an unknown error-field value (message, name, diff, stack, ...) into a
|
|
4
4
|
* string that is safe to bind to a SQLite TEXT column or render to a terminal.
|
|
@@ -56,5 +56,4 @@ const coerceErrorField = (source, key) => {
|
|
|
56
56
|
return coerceErrorText(value);
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
//#endregion
|
|
60
59
|
export { coerceErrorField, coerceErrorText };
|
package/utils/compress-lines.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/compress-lines.ts
|
|
2
2
|
/**
|
|
3
3
|
* Compress an array of line numbers into a compact range string.
|
|
4
4
|
*
|
|
@@ -41,5 +41,4 @@ function compressLines(lines) {
|
|
|
41
41
|
return ranges.join(",");
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
//#endregion
|
|
45
44
|
export { compressLines };
|
package/utils/compute-trend.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/compute-trend.ts
|
|
2
2
|
const STABLE_THRESHOLD = .1;
|
|
3
3
|
const MAX_ENTRIES = 50;
|
|
4
4
|
/**
|
|
@@ -84,5 +84,4 @@ function getRecentDirection(record, count = 5) {
|
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
//#endregion
|
|
88
87
|
export { computeTrend, getRecentDirection, hashTargets };
|
package/utils/console-leaks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/console-leaks.ts
|
|
2
2
|
const SAMPLE_MAX_CHARS = 160;
|
|
3
3
|
const MAX_FILES = 25;
|
|
4
4
|
const MAX_TESTS_PER_FILE = 10;
|
|
@@ -100,5 +100,4 @@ function collectConsoleLeakEntries(files) {
|
|
|
100
100
|
return entries;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
//#endregion
|
|
104
103
|
export { buildConsoleLeaks, collectConsoleLeakEntries };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/detect-non-default-discover-strategy.ts
|
|
2
2
|
/**
|
|
3
3
|
* Cheaply strips `//` line comments and `/* *\/` block comments from `source`.
|
|
4
4
|
*
|
|
@@ -53,5 +53,4 @@ function detectNonDefaultDiscoverStrategy(source) {
|
|
|
53
53
|
return DISCOVER_STRATEGY_OPTION_RE.test(stripped) || stripped.includes(ADD_PROJECT_MARKER) || EXTENDS_DEFAULT_STRATEGY_RE.test(stripped) || IMPLEMENTS_STRATEGY_RE.test(stripped);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
//#endregion
|
|
57
56
|
export { detectNonDefaultDiscoverStrategy };
|
package/utils/detect-pm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/detect-pm.ts
|
|
2
2
|
const LOCKFILE_MAP = [
|
|
3
3
|
["pnpm-lock.yaml", "pnpm"],
|
|
4
4
|
["package-lock.json", "npm"],
|
|
@@ -54,5 +54,4 @@ function getRunCommand(pm) {
|
|
|
54
54
|
return RUN_COMMANDS[pm];
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
//#endregion
|
|
58
57
|
export { detectPackageManager, getRunCommand };
|
package/utils/detect-timeout.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/detect-timeout.ts
|
|
2
2
|
const TIMEOUT_MESSAGE = /\btimed out in \d+\s*ms/i;
|
|
3
3
|
const TIMEOUT_NAME = /timeout/i;
|
|
4
4
|
/**
|
|
@@ -13,5 +13,4 @@ const isTimeoutError = (error) => {
|
|
|
13
13
|
return false;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
//#endregion
|
|
17
16
|
export { isTimeoutError };
|
package/utils/format-console.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ansi } from "./ansi.js";
|
|
2
2
|
import { formatScopedCoverageNote } from "./format-scoped-coverage-note.js";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/utils/format-console.ts
|
|
5
5
|
/**
|
|
6
6
|
* Return the metric with the lowest percentage from a `FileCoverageReport`.
|
|
7
7
|
*
|
|
@@ -219,5 +219,4 @@ function formatConsoleMarkdown(report, options) {
|
|
|
219
219
|
return lines.join("\n");
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
//#endregion
|
|
223
222
|
export { determineTier, formatConsoleMarkdown, getWorstMetric, relativePath };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Cause } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/utils/format-fatal-error.ts
|
|
4
4
|
const ISSUE_URL = "https://github.com/spencerbeggs/vitest-agent/issues";
|
|
5
5
|
const FIBER_FAILURE_CAUSE_KEY = Symbol.for("effect/Runtime/FiberFailure/Cause");
|
|
6
6
|
/**
|
|
@@ -43,5 +43,4 @@ function formatFatalError(err) {
|
|
|
43
43
|
return `${detail}\nPlease report at ${ISSUE_URL}`;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
//#endregion
|
|
47
46
|
export { formatFatalError };
|
package/utils/format-gfm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/format-scoped-coverage-note.ts
|
|
2
2
|
/**
|
|
3
3
|
* Format the informational note shown when coverage thresholds were
|
|
4
4
|
* skipped because a run only exercised a subset of the project's test
|
|
@@ -21,5 +21,4 @@ function formatScopedCoverageNote(testedFileCount, totalFileCount) {
|
|
|
21
21
|
return `Coverage thresholds skipped: partial run (${totalFileCount !== void 0 ? `${testedFileCount} of ${totalFileCount}` : `${testedFileCount}`} test files)`;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
//#endregion
|
|
25
24
|
export { formatScopedCoverageNote };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as acorn from "acorn";
|
|
2
2
|
import { tsPlugin } from "acorn-typescript";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/utils/function-boundary.ts
|
|
5
5
|
const Parser = acorn.Parser.extend(tsPlugin());
|
|
6
6
|
const isFunctionLike = (node) => node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression";
|
|
7
7
|
const containsLine = (node, line) => node.loc !== void 0 && node.loc.start.line <= line && node.loc.end.line >= line;
|
|
@@ -73,5 +73,4 @@ const findFunctionBoundary = (source, line) => {
|
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
//#endregion
|
|
77
76
|
export { findFunctionBoundary };
|
package/utils/hyperlink.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/hyperlink.ts
|
|
2
2
|
const ESC = "\x1B";
|
|
3
3
|
const BEL = "\x07";
|
|
4
4
|
/** @public */
|
|
@@ -7,5 +7,4 @@ const osc8 = (url, label, options) => {
|
|
|
7
7
|
return `${ESC}]8;;${url}${BEL}${label}${ESC}]8;;${BEL}`;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
//#endregion
|
|
11
10
|
export { osc8 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/match-vitest-command.ts
|
|
2
2
|
const RE_DIRECT = /^\s*vitest(\s|$)/;
|
|
3
3
|
const RE_RUNNER = /^\s*(npx|pnpx|bunx)\s+vitest(\s|$)/;
|
|
4
4
|
const RE_PM_EXEC = /^\s*(npm|pnpm|yarn|bun)\s+(exec|dlx|x)\s+vitest(\s|$)/;
|
|
@@ -84,5 +84,4 @@ const detectVitestScripts = (scripts) => {
|
|
|
84
84
|
return directHits;
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
//#endregion
|
|
88
87
|
export { buildEnvPrefix, detectVitestScripts, isVitestInvocation, rewriteBashCommand };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/normalize-workspace-key.ts
|
|
2
2
|
/**
|
|
3
3
|
* Normalize a workspace name into a filesystem-safe directory segment.
|
|
4
4
|
*
|
|
@@ -30,5 +30,4 @@ function normalizeWorkspaceKey(name) {
|
|
|
30
30
|
return name.replaceAll("/", "__").replace(/[^A-Za-z0-9._@-]/g, "_").replace(/_{3,}/g, "__");
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
//#endregion
|
|
34
33
|
export { normalizeWorkspaceKey };
|
package/utils/posix-path.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/posix-path.ts
|
|
2
2
|
/**
|
|
3
3
|
* Pure POSIX path helpers for the platform-free core.
|
|
4
4
|
*
|
|
@@ -48,5 +48,4 @@ const relativePosix = (from, to) => {
|
|
|
48
48
|
return target.startsWith(prefix) ? target.slice(prefix.length) : target;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
//#endregion
|
|
52
51
|
export { basenamePosix, joinPosix, relativePosix, toPosix };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/probe-host-metadata.ts
|
|
2
2
|
const isUseful = (value) => value !== void 0 && value.length > 0;
|
|
3
3
|
/**
|
|
4
4
|
* Walk the priority chain of env-var probes. Returns the first match
|
|
@@ -95,5 +95,4 @@ const probeHostMetadataFromEnv = (env) => {
|
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
-
//#endregion
|
|
99
98
|
export { probeHostMetadataFromEnv };
|
package/utils/safe-filename.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/safe-filename.ts
|
|
2
2
|
/**
|
|
3
3
|
* Convert a project name to a filesystem-safe filename.
|
|
4
4
|
*
|
|
@@ -30,5 +30,4 @@ function safeFilename(name) {
|
|
|
30
30
|
return name.replace(/[/:]/g, "__");
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
//#endregion
|
|
34
33
|
export { safeFilename };
|
package/utils/stray-output.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/stray-output.ts
|
|
2
2
|
const ESCAPE = /\x1b(?:\[[0-?]*[ -/]*[@-~]|\][^\x07\x1b]*(?:\x07|\x1b\\)|[@-Z\\-_]|c)/g;
|
|
3
3
|
const CONTROL = /[\x00-\x08\x0b-\x1f\x7f]/g;
|
|
4
4
|
/**
|
|
@@ -139,5 +139,4 @@ const formatStrayOutputNote = (stray) => {
|
|
|
139
139
|
return lines;
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
-
//#endregion
|
|
143
142
|
export { STRAY_OUTPUT_SOURCE, formatStrayOutputNote, isEscapeOnly, makeStrayOutputRecorder, readStrayOutput };
|
package/utils/test-location.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { basenamePosix, joinPosix, relativePosix, toPosix } from "./posix-path.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/utils/test-location.ts
|
|
4
4
|
/** Directory holding source files whose tests may be co-located. @public */
|
|
5
5
|
const SRC_DIR = "src";
|
|
6
6
|
/** Canonical test directory name. @public */
|
|
@@ -129,5 +129,4 @@ function classifyTestPath(workspaces, filePath) {
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
//#endregion
|
|
133
132
|
export { BATS_FILE_GLOB_SUFFIX, NON_DISCOVERABLE_DIRS, SRC_DIR, TEST_DIR, TEST_FILE_GLOB_SUFFIX, TEST_HELPER_DIRS, classifyTestPath, findOwningWorkspace, isTestFileName };
|