@vitest-agent/mcp 1.0.1 → 1.2.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.
Files changed (229) hide show
  1. package/README.md +1 -2
  2. package/bin/vitest-agent-mcp.js +1 -17
  3. package/index.d.ts +324 -315
  4. package/index.js +2 -4
  5. package/middleware/idempotency.js +1 -1
  6. package/package.json +2 -2
  7. package/server.js +2 -4
  8. package/tools/acceptance-metrics.js +1 -1
  9. package/tools/cache-health.js +1 -1
  10. package/tools/commit-changes.js +1 -1
  11. package/tools/configure.js +1 -1
  12. package/tools/coverage.js +1 -1
  13. package/tools/errors.js +1 -1
  14. package/tools/failure-signature-get.js +1 -1
  15. package/tools/file-coverage.js +1 -1
  16. package/tools/history.js +1 -1
  17. package/tools/inventory.js +1 -1
  18. package/tools/overview.js +1 -1
  19. package/tools/run-tests.js +15 -3
  20. package/tools/settings-list.js +1 -1
  21. package/tools/status.js +1 -1
  22. package/tools/tdd-artifact.js +1 -1
  23. package/tools/tdd-task.js +1 -1
  24. package/tools/test.js +1 -1
  25. package/tools/trends.js +1 -1
  26. package/tools/turn-search.js +1 -1
  27. package/public/patterns/_meta.json +0 -67
  28. package/public/patterns/authoring-a-custom-vitest-agent-reporter.md +0 -82
  29. package/public/patterns/known-issues-and-caveats.md +0 -52
  30. package/public/patterns/operating-vitest-agent-as-an-agent.md +0 -53
  31. package/public/patterns/running-tests-via-mcp.md +0 -58
  32. package/public/patterns/silencing-leaking-output-in-tests.md +0 -91
  33. package/public/patterns/testing-effect-schema-definitions.md +0 -71
  34. package/public/patterns/testing-effect-services-with-mock-layers.md +0 -63
  35. package/public/vendor/vitest-docs/ATTRIBUTION.md +0 -5
  36. package/public/vendor/vitest-docs/api/advanced/artifacts.md +0 -189
  37. package/public/vendor/vitest-docs/api/advanced/metadata.md +0 -68
  38. package/public/vendor/vitest-docs/api/advanced/plugin.md +0 -168
  39. package/public/vendor/vitest-docs/api/advanced/reporters.md +0 -342
  40. package/public/vendor/vitest-docs/api/advanced/runner.md +0 -334
  41. package/public/vendor/vitest-docs/api/advanced/test-case.md +0 -302
  42. package/public/vendor/vitest-docs/api/advanced/test-collection.md +0 -89
  43. package/public/vendor/vitest-docs/api/advanced/test-module.md +0 -140
  44. package/public/vendor/vitest-docs/api/advanced/test-project.md +0 -321
  45. package/public/vendor/vitest-docs/api/advanced/test-specification.md +0 -96
  46. package/public/vendor/vitest-docs/api/advanced/test-suite.md +0 -230
  47. package/public/vendor/vitest-docs/api/advanced/vitest.md +0 -684
  48. package/public/vendor/vitest-docs/api/assert-type.md +0 -22
  49. package/public/vendor/vitest-docs/api/assert.md +0 -1960
  50. package/public/vendor/vitest-docs/api/browser/assertions.md +0 -1277
  51. package/public/vendor/vitest-docs/api/browser/commands.md +0 -154
  52. package/public/vendor/vitest-docs/api/browser/context.md +0 -338
  53. package/public/vendor/vitest-docs/api/browser/interactivity.md +0 -681
  54. package/public/vendor/vitest-docs/api/browser/locators.md +0 -1171
  55. package/public/vendor/vitest-docs/api/browser/react.md +0 -346
  56. package/public/vendor/vitest-docs/api/browser/svelte.md +0 -292
  57. package/public/vendor/vitest-docs/api/browser/vue.md +0 -222
  58. package/public/vendor/vitest-docs/api/describe.md +0 -374
  59. package/public/vendor/vitest-docs/api/expect-typeof.md +0 -571
  60. package/public/vendor/vitest-docs/api/expect.md +0 -2304
  61. package/public/vendor/vitest-docs/api/hooks.md +0 -463
  62. package/public/vendor/vitest-docs/api/mock.md +0 -701
  63. package/public/vendor/vitest-docs/api/test.md +0 -926
  64. package/public/vendor/vitest-docs/api/vi.md +0 -1372
  65. package/public/vendor/vitest-docs/config/alias.md +0 -13
  66. package/public/vendor/vitest-docs/config/allowonly.md +0 -32
  67. package/public/vendor/vitest-docs/config/api.md +0 -27
  68. package/public/vendor/vitest-docs/config/attachmentsdir.md +0 -6
  69. package/public/vendor/vitest-docs/config/bail.md +0 -9
  70. package/public/vendor/vitest-docs/config/benchmark.md +0 -65
  71. package/public/vendor/vitest-docs/config/browser/api.md +0 -23
  72. package/public/vendor/vitest-docs/config/browser/commands.md +0 -6
  73. package/public/vendor/vitest-docs/config/browser/connecttimeout.md +0 -10
  74. package/public/vendor/vitest-docs/config/browser/detailspanelposition.md +0 -38
  75. package/public/vendor/vitest-docs/config/browser/enabled.md +0 -40
  76. package/public/vendor/vitest-docs/config/browser/expect.md +0 -250
  77. package/public/vendor/vitest-docs/config/browser/headless.md +0 -7
  78. package/public/vendor/vitest-docs/config/browser/instances.md +0 -47
  79. package/public/vendor/vitest-docs/config/browser/isolate.md +0 -11
  80. package/public/vendor/vitest-docs/config/browser/locators.md +0 -24
  81. package/public/vendor/vitest-docs/config/browser/orchestratorscripts.md +0 -39
  82. package/public/vendor/vitest-docs/config/browser/playwright.md +0 -214
  83. package/public/vendor/vitest-docs/config/browser/preview.md +0 -32
  84. package/public/vendor/vitest-docs/config/browser/provider.md +0 -79
  85. package/public/vendor/vitest-docs/config/browser/screenshotdirectory.md +0 -6
  86. package/public/vendor/vitest-docs/config/browser/screenshotfailures.md +0 -6
  87. package/public/vendor/vitest-docs/config/browser/testerhtmlpath.md +0 -5
  88. package/public/vendor/vitest-docs/config/browser/trace.md +0 -43
  89. package/public/vendor/vitest-docs/config/browser/trackunhandlederrors.md +0 -10
  90. package/public/vendor/vitest-docs/config/browser/ui.md +0 -7
  91. package/public/vendor/vitest-docs/config/browser/viewport.md +0 -6
  92. package/public/vendor/vitest-docs/config/browser/webdriverio.md +0 -64
  93. package/public/vendor/vitest-docs/config/cache.md +0 -26
  94. package/public/vendor/vitest-docs/config/chaiconfig.md +0 -29
  95. package/public/vendor/vitest-docs/config/clearmocks.md +0 -22
  96. package/public/vendor/vitest-docs/config/coverage.md +0 -455
  97. package/public/vendor/vitest-docs/config/css.md +0 -47
  98. package/public/vendor/vitest-docs/config/dangerouslyignoreunhandlederrors.md +0 -23
  99. package/public/vendor/vitest-docs/config/deps.md +0 -127
  100. package/public/vendor/vitest-docs/config/detectasyncleaks.md +0 -39
  101. package/public/vendor/vitest-docs/config/diff.md +0 -96
  102. package/public/vendor/vitest-docs/config/dir.md +0 -7
  103. package/public/vendor/vitest-docs/config/disableconsoleintercept.md +0 -15
  104. package/public/vendor/vitest-docs/config/env.md +0 -5
  105. package/public/vendor/vitest-docs/config/environment.md +0 -96
  106. package/public/vendor/vitest-docs/config/environmentoptions.md +0 -30
  107. package/public/vendor/vitest-docs/config/exclude.md +0 -49
  108. package/public/vendor/vitest-docs/config/execargv.md +0 -10
  109. package/public/vendor/vitest-docs/config/expandsnapshotdiff.md +0 -7
  110. package/public/vendor/vitest-docs/config/expect.md +0 -38
  111. package/public/vendor/vitest-docs/config/experimental.md +0 -510
  112. package/public/vendor/vitest-docs/config/faketimers.md +0 -51
  113. package/public/vendor/vitest-docs/config/fileparallelism.md +0 -11
  114. package/public/vendor/vitest-docs/config/forcereruntriggers.md +0 -19
  115. package/public/vendor/vitest-docs/config/globals.md +0 -42
  116. package/public/vendor/vitest-docs/config/globalsetup.md +0 -72
  117. package/public/vendor/vitest-docs/config/hideskippedtests.md +0 -7
  118. package/public/vendor/vitest-docs/config/hooktimeout.md +0 -7
  119. package/public/vendor/vitest-docs/config/include-source.md +0 -115
  120. package/public/vendor/vitest-docs/config/include.md +0 -71
  121. package/public/vendor/vitest-docs/config/includetasklocation.md +0 -17
  122. package/public/vendor/vitest-docs/config/index.md +0 -85
  123. package/public/vendor/vitest-docs/config/isolate.md +0 -13
  124. package/public/vendor/vitest-docs/config/logheapusage.md +0 -7
  125. package/public/vendor/vitest-docs/config/maxconcurrency.md +0 -9
  126. package/public/vendor/vitest-docs/config/maxworkers.md +0 -49
  127. package/public/vendor/vitest-docs/config/mockreset.md +0 -22
  128. package/public/vendor/vitest-docs/config/mode.md +0 -7
  129. package/public/vendor/vitest-docs/config/name.md +0 -111
  130. package/public/vendor/vitest-docs/config/onconsolelog.md +0 -25
  131. package/public/vendor/vitest-docs/config/onstacktrace.md +0 -32
  132. package/public/vendor/vitest-docs/config/onunhandlederror.md +0 -35
  133. package/public/vendor/vitest-docs/config/open.md +0 -7
  134. package/public/vendor/vitest-docs/config/outputfile.md +0 -7
  135. package/public/vendor/vitest-docs/config/passwithnotests.md +0 -7
  136. package/public/vendor/vitest-docs/config/pool.md +0 -45
  137. package/public/vendor/vitest-docs/config/printconsoletrace.md +0 -6
  138. package/public/vendor/vitest-docs/config/projects.md +0 -6
  139. package/public/vendor/vitest-docs/config/provide.md +0 -45
  140. package/public/vendor/vitest-docs/config/reporters.md +0 -69
  141. package/public/vendor/vitest-docs/config/resolvesnapshotpath.md +0 -36
  142. package/public/vendor/vitest-docs/config/restoremocks.md +0 -22
  143. package/public/vendor/vitest-docs/config/retry.md +0 -140
  144. package/public/vendor/vitest-docs/config/root.md +0 -6
  145. package/public/vendor/vitest-docs/config/runner.md +0 -6
  146. package/public/vendor/vitest-docs/config/sequence.md +0 -158
  147. package/public/vendor/vitest-docs/config/server.md +0 -68
  148. package/public/vendor/vitest-docs/config/setupfiles.md +0 -40
  149. package/public/vendor/vitest-docs/config/silent.md +0 -9
  150. package/public/vendor/vitest-docs/config/slowtestthreshold.md +0 -7
  151. package/public/vendor/vitest-docs/config/snapshotenvironment.md +0 -27
  152. package/public/vendor/vitest-docs/config/snapshotformat.md +0 -28
  153. package/public/vendor/vitest-docs/config/snapshotserializers.md +0 -6
  154. package/public/vendor/vitest-docs/config/stricttags.md +0 -30
  155. package/public/vendor/vitest-docs/config/tags.md +0 -141
  156. package/public/vendor/vitest-docs/config/teardowntimeout.md +0 -7
  157. package/public/vendor/vitest-docs/config/testnamepattern.md +0 -21
  158. package/public/vendor/vitest-docs/config/testtimeout.md +0 -7
  159. package/public/vendor/vitest-docs/config/typecheck.md +0 -77
  160. package/public/vendor/vitest-docs/config/ui.md +0 -15
  161. package/public/vendor/vitest-docs/config/unstubenvs.md +0 -20
  162. package/public/vendor/vitest-docs/config/unstubglobals.md +0 -20
  163. package/public/vendor/vitest-docs/config/update.md +0 -16
  164. package/public/vendor/vitest-docs/config/vmmemorylimit.md +0 -30
  165. package/public/vendor/vitest-docs/config/watch.md +0 -11
  166. package/public/vendor/vitest-docs/config/watchtriggerpatterns.md +0 -29
  167. package/public/vendor/vitest-docs/guide/advanced/index.md +0 -147
  168. package/public/vendor/vitest-docs/guide/advanced/pool.md +0 -148
  169. package/public/vendor/vitest-docs/guide/advanced/reporters.md +0 -93
  170. package/public/vendor/vitest-docs/guide/advanced/tests.md +0 -125
  171. package/public/vendor/vitest-docs/guide/browser/aria-snapshots.md +0 -470
  172. package/public/vendor/vitest-docs/guide/browser/component-testing.md +0 -571
  173. package/public/vendor/vitest-docs/guide/browser/index.md +0 -630
  174. package/public/vendor/vitest-docs/guide/browser/multiple-setups.md +0 -121
  175. package/public/vendor/vitest-docs/guide/browser/trace-view.md +0 -126
  176. package/public/vendor/vitest-docs/guide/browser/visual-regression-testing.md +0 -734
  177. package/public/vendor/vitest-docs/guide/cli-generated.md +0 -972
  178. package/public/vendor/vitest-docs/guide/cli.md +0 -234
  179. package/public/vendor/vitest-docs/guide/common-errors.md +0 -163
  180. package/public/vendor/vitest-docs/guide/coverage.md +0 -515
  181. package/public/vendor/vitest-docs/guide/debugging.md +0 -127
  182. package/public/vendor/vitest-docs/guide/environment.md +0 -101
  183. package/public/vendor/vitest-docs/guide/extending-matchers.md +0 -160
  184. package/public/vendor/vitest-docs/guide/features.md +0 -310
  185. package/public/vendor/vitest-docs/guide/filtering.md +0 -175
  186. package/public/vendor/vitest-docs/guide/ide.md +0 -43
  187. package/public/vendor/vitest-docs/guide/improving-performance.md +0 -245
  188. package/public/vendor/vitest-docs/guide/in-source.md +0 -159
  189. package/public/vendor/vitest-docs/guide/index.md +0 -128
  190. package/public/vendor/vitest-docs/guide/learn/async.md +0 -147
  191. package/public/vendor/vitest-docs/guide/learn/debugging-tests.md +0 -210
  192. package/public/vendor/vitest-docs/guide/learn/matchers.md +0 -277
  193. package/public/vendor/vitest-docs/guide/learn/mock-functions.md +0 -277
  194. package/public/vendor/vitest-docs/guide/learn/setup-teardown.md +0 -240
  195. package/public/vendor/vitest-docs/guide/learn/snapshots.md +0 -166
  196. package/public/vendor/vitest-docs/guide/learn/testing-in-practice.md +0 -430
  197. package/public/vendor/vitest-docs/guide/learn/writing-tests-with-ai.md +0 -127
  198. package/public/vendor/vitest-docs/guide/learn/writing-tests.md +0 -231
  199. package/public/vendor/vitest-docs/guide/lifecycle.md +0 -379
  200. package/public/vendor/vitest-docs/guide/migration.md +0 -863
  201. package/public/vendor/vitest-docs/guide/mocking/classes.md +0 -158
  202. package/public/vendor/vitest-docs/guide/mocking/dates.md +0 -52
  203. package/public/vendor/vitest-docs/guide/mocking/file-system.md +0 -74
  204. package/public/vendor/vitest-docs/guide/mocking/functions.md +0 -61
  205. package/public/vendor/vitest-docs/guide/mocking/globals.md +0 -20
  206. package/public/vendor/vitest-docs/guide/mocking/modules.md +0 -414
  207. package/public/vendor/vitest-docs/guide/mocking/requests.md +0 -114
  208. package/public/vendor/vitest-docs/guide/mocking/timers.md +0 -48
  209. package/public/vendor/vitest-docs/guide/mocking.md +0 -239
  210. package/public/vendor/vitest-docs/guide/open-telemetry.md +0 -156
  211. package/public/vendor/vitest-docs/guide/parallelism.md +0 -82
  212. package/public/vendor/vitest-docs/guide/profiling-test-performance.md +0 -243
  213. package/public/vendor/vitest-docs/guide/projects.md +0 -291
  214. package/public/vendor/vitest-docs/guide/recipes.md +0 -59
  215. package/public/vendor/vitest-docs/guide/reporters.md +0 -723
  216. package/public/vendor/vitest-docs/guide/snapshot.md +0 -620
  217. package/public/vendor/vitest-docs/guide/test-annotations.md +0 -103
  218. package/public/vendor/vitest-docs/guide/test-context.md +0 -902
  219. package/public/vendor/vitest-docs/guide/test-tags.md +0 -314
  220. package/public/vendor/vitest-docs/guide/testing-types.md +0 -149
  221. package/public/vendor/vitest-docs/guide/ui.md +0 -160
  222. package/public/vendor/vitest-docs/guide/using-plugins.md +0 -5
  223. package/public/vendor/vitest-docs/manifest.json +0 -1691
  224. package/resources/index.js +0 -166
  225. package/resources/indexes.js +0 -77
  226. package/resources/manifest-schema.js +0 -46
  227. package/resources/paths.js +0 -20
  228. package/resources/patterns.js +0 -22
  229. package/resources/upstream-docs.js +0 -22
package/index.js CHANGED
@@ -7,13 +7,11 @@ import { startMcpServer } from "./server.js";
7
7
  /**
8
8
  * The version of this package, inlined at build time from
9
9
  * package.json#version via rslib-builder's __PACKAGE_VERSION__ substitution.
10
- * Compared against CURRENT_SDK_VERSION at MCP bin init to surface
11
- * partially-upgraded installs as a single stderr warning. See the root
12
- * CLAUDE.md "Cross-package version drift" section.
10
+ * Exported for version introspection by downstream tooling.
13
11
  *
14
12
  * @public
15
13
  */
16
- const CURRENT_MCP_VERSION = "1.0.1";
14
+ const CURRENT_MCP_VERSION = "1.2.0";
17
15
 
18
16
  //#endregion
19
17
  export { CURRENT_MCP_VERSION, McpLive, appRouter, createCallerFactory, createCurrentSessionIdRef, createSessionContextRef, startMcpServer };
@@ -125,4 +125,4 @@ const idempotent = middleware(async (opts) => {
125
125
  const idempotentProcedure = publicProcedure.use(idempotent);
126
126
 
127
127
  //#endregion
128
- export { idempotentProcedure };
128
+ export { idempotencyKeys, idempotentProcedure };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitest-agent/mcp",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "private": false,
5
5
  "description": "Model Context Protocol server for vitest-agent. Exposes 53 tools for agent access to test data, TDD lifecycle, and session management.",
6
6
  "keywords": [
@@ -45,7 +45,7 @@
45
45
  "@effect/sql-sqlite-node": "^0.52.0",
46
46
  "@modelcontextprotocol/sdk": "^1.29.0",
47
47
  "@trpc/server": "^11.18.0",
48
- "@vitest-agent/sdk": "1.0.1",
48
+ "@vitest-agent/sdk": "1.1.0",
49
49
  "effect": "^3.21.4",
50
50
  "zod": "^4.4.3"
51
51
  },
package/server.js CHANGED
@@ -30,7 +30,6 @@ import { TurnSearchAsMarkdown, TurnSearchResult } from "./tools/turn-search.js";
30
30
  import { WrapupPromptResult } from "./tools/wrapup-prompt.js";
31
31
  import { appRouter } from "./router.js";
32
32
  import { registerAllPrompts } from "./prompts/index.js";
33
- import { registerAllResources } from "./resources/index.js";
34
33
  import { effectToZodSchema } from "./utils/effect-to-zod.js";
35
34
  import { ChannelEvent, DataReader } from "@vitest-agent/sdk";
36
35
  import { Effect, Option, Schema } from "effect";
@@ -123,10 +122,10 @@ function structuredJsonResult(value) {
123
122
  return structuredResult(JSON.stringify(value, null, 2), value);
124
123
  }
125
124
  /**
126
- * Starts the MCP server over stdio, registering all tools, resources, and prompts.
125
+ * Starts the MCP server over stdio, registering all tools and prompts.
127
126
  *
128
127
  * Constructs the MCP server instance, registers all tRPC-backed tools (wired through
129
- * `ctx.runtime`), calls `registerAllResources` and `registerAllPrompts`, then connects
128
+ * `ctx.runtime`), calls `registerAllPrompts`, then connects
130
129
  * a `StdioServerTransport`. Returns when the transport disconnects.
131
130
  *
132
131
  * @param ctx - the MCP context carrying the shared ManagedRuntime and session refs
@@ -828,7 +827,6 @@ async function startMcpServer(ctx) {
828
827
  const data = await caller.ping();
829
828
  return structuredResult(data.message, data);
830
829
  });
831
- registerAllResources(server);
832
830
  registerAllPrompts(server);
833
831
  const transport = new StdioServerTransport();
834
832
  await server.connect(transport);
@@ -72,4 +72,4 @@ const acceptanceMetrics = publicProcedure.input(Schema.standardSchemaV1(Schema.S
72
72
  })));
73
73
 
74
74
  //#endregion
75
- export { AcceptanceMetricsAsMarkdown, AcceptanceMetricsResult, acceptanceMetrics };
75
+ export { AcceptanceMetricsAsMarkdown, AcceptanceMetricsResult, acceptanceMetrics, formatAcceptanceMetricsMarkdown };
@@ -80,4 +80,4 @@ const cacheHealth = publicProcedure.query(async ({ ctx }) => ctx.runtime.runProm
80
80
  })));
81
81
 
82
82
  //#endregion
83
- export { CacheHealthAsMarkdown, CacheHealthResult, cacheHealth };
83
+ export { CacheHealthAsMarkdown, CacheHealthResult, cacheHealth, formatCacheHealthMarkdown };
@@ -61,4 +61,4 @@ const commitChanges = publicProcedure.input(Schema.standardSchemaV1(Schema.Struc
61
61
  })));
62
62
 
63
63
  //#endregion
64
- export { CommitChangesAsMarkdown, CommitChangesResult, commitChanges };
64
+ export { CommitChangesAsMarkdown, CommitChangesResult, commitChanges, formatCommitChangesMarkdown };
@@ -104,4 +104,4 @@ const configure = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
104
104
  })));
105
105
 
106
106
  //#endregion
107
- export { ConfigureAsMarkdown, ConfigureResult, configure };
107
+ export { ConfigureAsMarkdown, ConfigureResult, configure, formatConfigureMarkdown };
package/tools/coverage.js CHANGED
@@ -73,4 +73,4 @@ const testCoverage = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct
73
73
  })));
74
74
 
75
75
  //#endregion
76
- export { TestCoverageAsMarkdown, TestCoverageResult, testCoverage };
76
+ export { TestCoverageAsMarkdown, TestCoverageResult, formatTestCoverageMarkdown, testCoverage };
package/tools/errors.js CHANGED
@@ -148,4 +148,4 @@ const testErrors = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
148
148
  })));
149
149
 
150
150
  //#endregion
151
- export { TestErrorsAsMarkdown, TestErrorsResult, testErrors };
151
+ export { TestErrorRow, TestErrorsAsMarkdown, TestErrorsResult, formatTestErrorsMarkdown, testErrors };
@@ -70,4 +70,4 @@ const failureSignatureGet = publicProcedure.input(Schema.standardSchemaV1(Schema
70
70
  })));
71
71
 
72
72
  //#endregion
73
- export { FailureSignatureGetAsMarkdown, FailureSignatureGetResult, failureSignatureGet };
73
+ export { FailureSignatureGetAsMarkdown, FailureSignatureGetResult, failureSignatureGet, formatFailureSignatureMarkdown };
@@ -103,4 +103,4 @@ const fileCoverage = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct
103
103
  })));
104
104
 
105
105
  //#endregion
106
- export { FileCoverageAsMarkdown, FileCoverageResult, fileCoverage };
106
+ export { FileCoverageAsMarkdown, FileCoverageResult, fileCoverage, formatFileCoverageMarkdown };
package/tools/history.js CHANGED
@@ -118,4 +118,4 @@ const testHistory = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct(
118
118
  })));
119
119
 
120
120
  //#endregion
121
- export { TestHistoryAsMarkdown, TestHistoryResult, testHistory };
121
+ export { TestHistoryAsMarkdown, TestHistoryResult, formatTestHistoryMarkdown, testHistory };
@@ -374,4 +374,4 @@ const inventory = publicProcedure.input(Schema.standardSchemaV1(InventoryInput))
374
374
  });
375
375
 
376
376
  //#endregion
377
- export { InventoryAsMarkdown, InventoryResult, inventory };
377
+ export { InventoryAsMarkdown, InventoryResult, formatInventoryMarkdown, inventory };
package/tools/overview.js CHANGED
@@ -89,4 +89,4 @@ const testOverview = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct
89
89
  })));
90
90
 
91
91
  //#endregion
92
- export { TestOverviewAsMarkdown, TestOverviewResult, testOverview };
92
+ export { TestOverviewAsMarkdown, TestOverviewResult, formatTestOverviewMarkdown, testOverview };
@@ -1,5 +1,5 @@
1
1
  import { publicProcedure } from "../context.js";
2
- import { AgentReport, DataReader, DataStore, buildAgentReport } from "@vitest-agent/sdk";
2
+ import { AgentReport, DataReader, DataStore, buildAgentReport, buildConsoleLeaks, collectConsoleLeakEntries } from "@vitest-agent/sdk";
3
3
  import { Effect, ParseResult, Schema } from "effect";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { Writable } from "node:stream";
@@ -209,6 +209,13 @@ function formatReportMarkdown(report, classifications) {
209
209
  if (summary.skipped > 0) headlineParts.push(`${summary.skipped} skipped`);
210
210
  lines.push(`## ${status} Vitest -- ${headlineParts.join(", ")} (${summary.duration}ms)`);
211
211
  if (report.project) lines.push(`\nProject: ${report.project}`);
212
+ if (report.consoleLeaks !== void 0) {
213
+ const cl = report.consoleLeaks;
214
+ const writes = `${cl.total} stray console write${cl.total === 1 ? "" : "s"}`;
215
+ const plural = cl.byFile.length !== 1 || cl.truncated === true;
216
+ const files = `${cl.byFile.length}${cl.truncated === true ? "+" : ""} file${plural ? "s" : ""}`;
217
+ lines.push(`\n⚠ ${writes} across ${files} (see consoleLeaks)`);
218
+ }
212
219
  for (const mod of report.failed) {
213
220
  lines.push(`\n### \u274C \`${mod.file}\``);
214
221
  if (mod.errors) for (const err of mod.errors) {
@@ -313,7 +320,12 @@ const runTests = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
313
320
  resolvedExpression
314
321
  }
315
322
  };
316
- const report = buildAgentReport(testModules, unhandledErrors, unhandledErrors.length > 0 || result.testModules.some((m) => m.state() === "failed") ? "failed" : "passed", { omitPassingTests: true });
323
+ const baseReport = buildAgentReport(testModules, unhandledErrors, unhandledErrors.length > 0 || result.testModules.some((m) => m.state() === "failed") ? "failed" : "passed", { omitPassingTests: true });
324
+ const leaks = buildConsoleLeaks(collectConsoleLeakEntries(localVitest.state.getFiles()));
325
+ const report = leaks !== void 0 ? {
326
+ ...baseReport,
327
+ consoleLeaks: leaks
328
+ } : baseReport;
317
329
  let classifications;
318
330
  try {
319
331
  classifications = await ctx.runtime.runPromise(Effect.gen(function* () {
@@ -356,4 +368,4 @@ const runTests = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
356
368
  }));
357
369
 
358
370
  //#endregion
359
- export { RunTestsAsMarkdown, RunTestsResult, runTests };
371
+ export { RunTestsAsMarkdown, RunTestsResult, coerceErrors, composeTagExpression, formatNoMatchMarkdown, formatReportMarkdown, formatRunTestsMarkdown, runTests, sanitizeTestArgs, withStdioCaptured };
@@ -45,4 +45,4 @@ const settingsList = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct
45
45
  })));
46
46
 
47
47
  //#endregion
48
- export { SettingsListAsMarkdown, SettingsListResult, settingsList };
48
+ export { SettingsListAsMarkdown, SettingsListResult, formatSettingsListMarkdown, settingsList };
package/tools/status.js CHANGED
@@ -71,4 +71,4 @@ const testStatus = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
71
71
  })));
72
72
 
73
73
  //#endregion
74
- export { TestStatusAsMarkdown, TestStatusResult, testStatus };
74
+ export { TestStatusAsMarkdown, TestStatusResult, formatTestStatusMarkdown, testStatus };
@@ -98,4 +98,4 @@ const tddArtifactList = publicProcedure.input(Schema.standardSchemaV1(TddArtifac
98
98
  })));
99
99
 
100
100
  //#endregion
101
- export { TddArtifactListAsMarkdown, TddArtifactListResult, tddArtifactList };
101
+ export { TddArtifactListAsMarkdown, TddArtifactListResult, formatTddArtifactListMarkdown, tddArtifactList };
package/tools/tdd-task.js CHANGED
@@ -275,4 +275,4 @@ const tddTask = idempotentProcedure.input(Schema.standardSchemaV1(TddTaskInput))
275
275
  });
276
276
 
277
277
  //#endregion
278
- export { TddTaskAsMarkdown, TddTaskResult, tddTask };
278
+ export { TddTaskAsMarkdown, TddTaskResult, formatTddTaskMarkdown, tddTask };
package/tools/test.js CHANGED
@@ -278,4 +278,4 @@ const test = publicProcedure.input(Schema.standardSchemaV1(TestInput)).query(asy
278
278
  });
279
279
 
280
280
  //#endregion
281
- export { TestAsMarkdown, TestResult, test };
281
+ export { TestAsMarkdown, TestResult, formatTestMarkdown, test };
package/tools/trends.js CHANGED
@@ -109,4 +109,4 @@ const testTrends = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
109
109
  })));
110
110
 
111
111
  //#endregion
112
- export { TestTrendsAsMarkdown, TestTrendsResult, testTrends };
112
+ export { TestTrendsAsMarkdown, TestTrendsResult, formatTestTrendsMarkdown, testTrends };
@@ -57,4 +57,4 @@ const turnSearch = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
57
57
  })));
58
58
 
59
59
  //#endregion
60
- export { TurnSearchAsMarkdown, TurnSearchResult, turnSearch };
60
+ export { TurnSearchAsMarkdown, TurnSearchResult, formatTurnSearchMarkdown, turnSearch };
@@ -1,67 +0,0 @@
1
- {
2
- "patterns": [
3
- {
4
- "slug": "testing-effect-services-with-mock-layers",
5
- "title": "Testing Effect Services with Mock Layers",
6
- "summary": "Compose live and test layers, swap platform layers, assert on accumulated writes via state-container test layers.",
7
- "annotations": {
8
- "audience": ["assistant"],
9
- "priority": 0.9
10
- }
11
- },
12
- {
13
- "slug": "testing-effect-schema-definitions",
14
- "title": "Testing Effect Schema Definitions",
15
- "summary": "Round-trip Schema.Class and Schema.Struct, branded types, transformations, and decoding error assertions.",
16
- "annotations": {
17
- "audience": ["assistant"],
18
- "priority": 0.9
19
- }
20
- },
21
- {
22
- "slug": "authoring-a-custom-vitest-agent-reporter",
23
- "title": "Authoring a Custom vitest-agent Reporter",
24
- "summary": "Implement the VitestAgentReporterFactory contract: ReporterKit, RenderedOutput targets, stdOsc8 hyperlinks, composing with the default reporter.",
25
- "annotations": {
26
- "audience": ["assistant"],
27
- "priority": 0.7
28
- }
29
- },
30
- {
31
- "slug": "running-tests-via-mcp",
32
- "title": "Running Tests via the MCP run_tests Tool",
33
- "summary": "Scope runs with project/files/tags (there is no `filter` param), read the four-variant return shape, and understand why subset runs 'fail' coverage thresholds.",
34
- "annotations": {
35
- "audience": ["assistant"],
36
- "priority": 0.9
37
- }
38
- },
39
- {
40
- "slug": "silencing-leaking-output-in-tests",
41
- "title": "Silencing Leaking Log / Build Output in Tests",
42
- "summary": "Decision tree mapping each noise source (Effect logger, console.*, rsbuild, tsdown, API Extractor) to its silencing technique, with an assert-on-output guardrail.",
43
- "annotations": {
44
- "audience": ["assistant"],
45
- "priority": 0.8
46
- }
47
- },
48
- {
49
- "slug": "known-issues-and-caveats",
50
- "title": "Known Issues & Instrumentation Caveats",
51
- "summary": "Distinguishes real vitest-agent issues (DataStoreError UNIQUE race) from upstream Vitest caveats (coverage-dir ENOENT), already-fixed bugs (perf_hooks), and misconceptions (discovery-cache staleness).",
52
- "annotations": {
53
- "audience": ["assistant"],
54
- "priority": 0.7
55
- }
56
- },
57
- {
58
- "slug": "operating-vitest-agent-as-an-agent",
59
- "title": "Operating vitest-agent as an Agent",
60
- "summary": "Read first: the front-loaded facts an agent needs (no run_tests filter param, coverage-in-subset behavior, console output is config-driven not env-driven, attribution is auto-recovered) with links to the deeper patterns.",
61
- "annotations": {
62
- "audience": ["assistant"],
63
- "priority": 0.95
64
- }
65
- }
66
- ]
67
- }
@@ -1,82 +0,0 @@
1
- # Authoring a Custom vitest-agent Reporter
2
-
3
- ## When to use
4
-
5
- You want output behavior that the named factories in `@vitest-agent/reporter` (`defaultReporter`, `markdownReporter`, `jsonReporter`, etc.) do not provide. Examples: SARIF output for code-scanning ingestion, JUnit XML alongside the default markdown, a side-channel that posts to an internal API.
6
-
7
- ## The contract
8
-
9
- A reporter is a function that takes a `ReporterKit` and returns either a single `VitestAgentReporter` or an array. A reporter has exactly one method: synchronous `render(input)` that returns `RenderedOutput[]`. No I/O, no Vitest lifecycle. The plugin handles persistence, classification, baselines, and trends; reporters render the resulting data and the plugin routes the outputs to their declared targets.
10
-
11
- ```typescript
12
- type VitestAgentReporterFactory =
13
- (kit: ReporterKit) =>
14
- VitestAgentReporter | ReadonlyArray<VitestAgentReporter>;
15
-
16
- interface VitestAgentReporter {
17
- readonly render:
18
- (input: ReporterRenderInput) => ReadonlyArray<RenderedOutput>;
19
- }
20
- ```
21
-
22
- `ReporterKit` carries `config`, `stdEnv`, and `stdOsc8` (a pre-bound hyperlink helper). `ReporterRenderInput` carries `reports` (one per project), `classifications` (a Map keyed by `TestReport.fullName`), and an optional `trendSummary`.
23
-
24
- ## Minimal example: a SARIF sidecar
25
-
26
- ```typescript
27
- import type { VitestAgentReporterFactory } from "@vitest-agent/sdk";
28
-
29
- export const sarifReporter: VitestAgentReporterFactory = (kit) => ({
30
- render: (input) => {
31
- const sarif = buildSarif(input.reports);
32
- return [
33
- {
34
- target: "file",
35
- content: JSON.stringify(sarif),
36
- contentType: "application/sarif+json",
37
- },
38
- ];
39
- },
40
- });
41
- ```
42
-
43
- The `target: "file"` slot is reserved for arbitrary on-disk artifacts; the convention for resolving the path will land in a future minor (currently a no-op routing target). Until then, use `target: "stdout"` for output that should reach the user immediately.
44
-
45
- ## Composing with the default
46
-
47
- If you want your reporter to layer on top of the default rather than replace it, return an array:
48
-
49
- ```typescript
50
- import { defaultReporter, type VitestAgentReporterFactory } from "@vitest-agent/reporter";
51
-
52
- export const myReporter: VitestAgentReporterFactory = (kit) => {
53
- const inner = defaultReporter(kit);
54
- const innerArr = Array.isArray(inner) ? inner : [inner];
55
- return [...innerArr, sarifReporter(kit)];
56
- };
57
- ```
58
-
59
- ## Wiring into the plugin
60
-
61
- ```typescript
62
- // vitest.config.ts
63
- import { defineConfig } from "vitest/config";
64
- import { agentPlugin } from "@vitest-agent/plugin";
65
- import { myReporter } from "./my-reporter.js";
66
-
67
- export default defineConfig({
68
- plugins: [agentPlugin({ reporterFactory: myReporter })],
69
- });
70
- ```
71
-
72
- ## Anti-patterns
73
-
74
- - **Don't reach into Vitest's lifecycle from a reporter.** The plugin owns it. If you need a Vitest hook, you have outgrown this contract — fork the plugin instead.
75
- - **Don't return Promises from `render`.** The contract is sync. If you have async work, do it ahead of time and pass the resolved data into your factory closure.
76
- - **Don't use `stdOsc8` outside terminal targets.** OSC-8 escapes only render in capable terminals; `kit.stdOsc8` already gates this for you. Calling it from a `target: "github-summary"` reporter is harmless (it returns the bare label) but signals confused intent.
77
-
78
- ## See also
79
-
80
- - `vitest://docs/api/advanced/reporters` — Vitest's own reporter API (different surface; informative for context)
81
- - `packages/reporter/src/default.ts` — The composition pattern the default reporter uses
82
- - `packages/sdk/src/contracts/reporter.ts` — Full type definitions for the contract
@@ -1,52 +0,0 @@
1
- # Known Issues & Instrumentation Caveats
2
-
3
- ## When to use
4
-
5
- A test run surfaced an error or oddity that looks like a vitest-agent bug.
6
- Check it against this list first — several are upstream Vitest behavior, an
7
- already-shipped fix, or a misconception, not something to investigate as a
8
- consumer-side problem.
9
-
10
- ## `DataStoreError` on a UNIQUE collision — live, retry
11
-
12
- A concurrent agent registration (on `idempotency_key`) or two concurrent turn
13
- writes (on `(session_id, turn_no)`) can race the persistence layer's
14
- check-then-insert and surface a `DataStoreError` carrying
15
- `UNIQUE constraint failed`. It is not a consumer bug and not data corruption —
16
- retry the operation. The SELECT pre-check narrows but does not close the race.
17
-
18
- ## `coverage/.tmp … ENOENT coverage-0.json` — inherent Vitest, not a bug
19
-
20
- Running Vitest in two processes at once (for example a CLI run alongside the
21
- `vitest-vscode` extension) makes them share Vitest's default
22
- `coverage.reportsDirectory`, and one process can delete the temp dir the other
23
- is writing. vitest-agent never sets `reportsDirectory`, so this is an upstream
24
- multi-process Vitest caveat. Give each concurrent process its own
25
- `coverage.reportsDirectory` (or serialize them).
26
-
27
- ## `MaxPerformanceEntryBufferExceededWarning` — resolved, stop chasing it
28
-
29
- This `perf_hooks` warning on long runs was fixed in a shipped
30
- `@vitest-agent/reporter` release: React 19's development reconciler emits a
31
- `performance.measure()` per render, and the live renderer now drains Node's
32
- user-timing buffer after each render cycle. If you still see it, update
33
- `@vitest-agent/reporter`. Do not investigate it as a fault in your own repo.
34
-
35
- ## Stale test counts — re-run, there is no warm cache
36
-
37
- Moving or adding test files does not require an MCP restart. Discovery is
38
- re-walked fresh on every Vitest run; the MCP serves counts from the database,
39
- which only updates when tests are re-run. Stale numbers mean the tests have not
40
- been re-run — not that a discovery cache is warm. Restarting the MCP would not
41
- refresh them.
42
-
43
- ## A run that rebuilds `dist/` mid-run — expected
44
-
45
- A host project's Vitest `globalSetup` may call `AgentPlugin.runScript(...)`
46
- (for example `pnpm turbo run build:dev`), which can transiently tear down and
47
- rebuild `dist/` during the run. This is the host project's configuration, not a
48
- broken workspace.
49
-
50
- ## See also
51
-
52
- - `vitest-agent://patterns/running-tests-via-mcp` — why subset runs "fail" coverage thresholds
@@ -1,53 +0,0 @@
1
- # Operating vitest-agent as an Agent
2
-
3
- ## When to use
4
-
5
- Read this first when you are an agent driving a project that uses
6
- `@vitest-agent/*`. It front-loads the handful of facts that otherwise cost
7
- trial-and-error, then points you at the deeper patterns.
8
-
9
- ## The facts that save the most time
10
-
11
- 1. **Run tests with `run_tests`, not Bash `vitest`.** `run_tests` persists
12
- results, classifications, coverage, and history and fires the post-tool-use
13
- hooks. Shelling out to `vitest` bypasses all of that.
14
- 2. **`run_tests` has no `filter` parameter.** Scope with `project` (the Vitest
15
- project name), `files` (globs), or `tags`. An unknown key like `filter` is
16
- silently dropped, so the whole suite runs.
17
- 3. **Subset runs "fail" coverage thresholds by design.** A single-file run
18
- exiting with `ERROR: Coverage … does not meet global threshold` is expected
19
- — global thresholds applied to partial coverage. There is no per-run
20
- coverage toggle in `run_tests`; it inherits your `vitest.config`. For
21
- isolated inspection use the CLI: `vitest run <file> --coverage.enabled=false`.
22
- 4. **You cannot see stray `console.log` through `run_tests`** — it null-routes
23
- Vitest's stdout. Console behavior is configured via the plugin's `console`
24
- matrix (e.g. `console: { agent: "passthrough" }`), **not** environment
25
- variables. To see intercepted output, run Vitest directly with
26
- `--disableConsoleIntercept` (a native Vitest flag).
27
- 5. **Session attribution is recovered for you.** The SessionStart hook writes
28
- the `VITEST_AGENT_*` identity into the environment and the SDK recovers it —
29
- you never set those vars by hand. The only behavioral knobs are
30
- `VITEST_REPORTER_LOG_LEVEL`, `VITEST_REPORTER_LOG_FILE`, and `NO_COLOR`.
31
- 6. **Stale counts mean tests were not re-run**, not a warm cache. Discovery
32
- re-walks per Vitest run; the MCP serves counts from the database.
33
- 7. **Some "leaks" are guardrail tests** that assert on their own output. Do not
34
- silence output a test captures and `expect`s on.
35
-
36
- ## Environment, briefly
37
-
38
- You do not configure vitest-agent through environment variables. The
39
- `VITEST_AGENT_*` vars (chat id, conversation id, agent ids, project dir,
40
- sidecar bin) are attribution plumbing written by the Claude Code plugin's
41
- SessionStart hook and recovered automatically. The only vars you might set for
42
- diagnostics are `VITEST_REPORTER_LOG_LEVEL` / `VITEST_REPORTER_LOG_FILE` (a
43
- diagnostic log file, separate from the console reporter) and `NO_COLOR`.
44
-
45
- ## Where to go next
46
-
47
- | You want to… | Read |
48
- | --- | --- |
49
- | Scope a run, read the return shape, understand coverage-in-subset | `vitest-agent://patterns/running-tests-via-mcp` |
50
- | Silence noisy log/build output in tests | `vitest-agent://patterns/silencing-leaking-output-in-tests` |
51
- | Tell tooling noise apart from real failures | `vitest-agent://patterns/known-issues-and-caveats` |
52
- | Read the full console-mode matrix (human prose) | <https://vitest-agent.dev/guide/console-modes> |
53
- | The human-facing version of this page | <https://vitest-agent.dev/guide/operating-as-an-agent> |
@@ -1,58 +0,0 @@
1
- # Running Tests via the MCP `run_tests` Tool
2
-
3
- ## When to use
4
-
5
- You want to execute the Vitest suite (or a subset) from an agent. Always prefer `run_tests` over shelling out to `vitest` — it persists results, classifications, coverage, and history to the project database and drives the post-tool-use hooks. Re-running `vitest` over Bash bypasses all of that.
6
-
7
- ## Scoping a run — there is no `filter` parameter
8
-
9
- `run_tests` accepts exactly these inputs:
10
-
11
- | Field | Type | Default | Scopes by |
12
- | --- | --- | --- | --- |
13
- | `files` | `string[]` | `[]` | Vitest file patterns: exact paths or globs |
14
- | `project` | `string` | unset | The Vitest **project name** from your config |
15
- | `tags` | `{ all?: string[]; any?: string[]; none?: string[] }` | unset | Vitest tag expression |
16
- | `passWithNoTests` | `boolean` | config value | Per-call override of `test.passWithNoTests` |
17
- | `timeout` | `number` (seconds) | `120` | Per-call run timeout |
18
-
19
- There is **no** `filter` field. Passing one (`run_tests({ filter: "@my/pkg" })`) is silently dropped — the call then runs with no filters, so the **entire** suite executes. To scope to one package, pass its Vitest project name as `project`; to scope to one file, pass it in `files`.
20
-
21
- `project` matches the project **name** defined in `vitest.config.ts`, not the npm package name. They often differ — check your config for the actual project name.
22
-
23
- `tags` sub-filters AND together (with each other and with `project`/`files`): `all` → `"a and b"`, `any` → `"(a or b)"`, `none` → `"not a and not b"`.
24
-
25
- ## Return shape
26
-
27
- `run_tests` returns one of four variants — discriminate on `kind`:
28
-
29
- | `kind` | Fields | Meaning |
30
- | --- | --- | --- |
31
- | `"ok"` | `report`, `classifications` (map of test full-name → `stable`/`new-failure`/`persistent`/`flaky`/`recovered`), optional `project` | The run completed |
32
- | `"no-match"` | `filter` (the resolved `project`/`files`/`tags`/`resolvedExpression`) | A filter was supplied but matched zero tests |
33
- | `"timeout"` | `timeoutSeconds` | Exceeded the timeout |
34
- | `"error"` | `message` | The run errored |
35
-
36
- A `no-match` is filter-driven: it fires when you supplied a filter and zero tests matched. Treat it as a finding (typo in `project`/`files`?) rather than a pass.
37
-
38
- ## Coverage on subset runs reads as a failure — by design
39
-
40
- A single-file or single-project run will commonly exit non-zero with:
41
-
42
- ```text
43
- ERROR: Coverage for lines (59.91%) does not meet global threshold (70%)
44
- ```
45
-
46
- This is expected: your global coverage thresholds are applied to a partial run, so partial coverage "fails" them. It is not a real test failure.
47
-
48
- `run_tests` has **no per-run coverage toggle** — it deliberately inherits your `vitest.config` `coverage.enabled` (forcing it off here used to override intentional "coverage on by default" setups). For clean isolated inspection, drop to the CLI:
49
-
50
- ```bash
51
- vitest run path/to/one.test.ts --coverage.enabled=false
52
- ```
53
-
54
- ## See also
55
-
56
- - `vitest-agent://patterns/operating-vitest-agent-as-an-agent` — the orientation index
57
- - `vitest-agent://patterns/known-issues-and-caveats` — coverage-dir races and other instrumentation caveats
58
- - `vitest://docs/config/index` — Vitest's native config reference
@@ -1,91 +0,0 @@
1
- # Silencing Leaking Log / Build Output in Tests
2
-
3
- ## When to use
4
-
5
- A test run is polluted with stray log lines, build-tool banners, or framework
6
- diagnostics that drown the signal. The fix differs per source — identify the
7
- source first, then apply the matching technique.
8
-
9
- ## Guardrail: do not silence output a test asserts on
10
-
11
- Before silencing anything, confirm the test does not capture and `expect` on
12
- the output. Some tests deliberately spy on `process.stdout.write` /
13
- `process.stderr.write` (or `console.*`) and assert on `.mock.calls` to verify
14
- what a formatter emits. Silencing those breaks the assertion. If you see a
15
- `vi.spyOn(process.stdout, "write")` whose `.mock.calls` are asserted, that
16
- output is the test subject — leave it alone.
17
-
18
- ## Decision tree
19
-
20
- | Source (what the noise looks like) | Technique |
21
- | --- | --- |
22
- | Effect default logger (`timestamp=… level=INFO message=…`) | Provide a silent logger layer |
23
- | Plain `console.log` / `console.warn` / `console.error` | Spy + mock the method |
24
- | rsbuild (`info build started…`, file-size table) | Set `@rsbuild/core` logger level to silent |
25
- | tsdown / rolldown (`ℹ entry:`, `✔ Build complete`) | Pass `logLevel: "silent"` to the build |
26
- | API Extractor (`(ae-missing-release-tag)` to stderr) | Pass an `onMessage` handler that marks messages handled |
27
-
28
- ## Effect default logger
29
-
30
- Provide a silent logger at the run/layer boundary. This mirrors how the SDK's
31
- own `LoggerLive` builds its silent variant (`packages/sdk/src/layers/LoggerLive.ts`):
32
-
33
- ```typescript
34
- import { Effect, Logger } from "effect";
35
-
36
- const silent = Logger.replace(Logger.defaultLogger, Logger.none);
37
-
38
- await Effect.runPromise(program.pipe(Effect.provide(silent)));
39
- ```
40
-
41
- `Logger.minimumLogLevel(LogLevel.None)` is an equivalent gate.
42
-
43
- ## Plain `console.*`
44
-
45
- ```typescript
46
- import { beforeEach, vi } from "vitest";
47
-
48
- beforeEach(() => {
49
- vi.spyOn(console, "warn").mockImplementation(() => {});
50
- vi.spyOn(console, "error").mockImplementation(() => {});
51
- });
52
- ```
53
-
54
- ## rsbuild reporter
55
-
56
- rsbuild writes through its own `logger` singleton, **not** `console.*`, so
57
- console mocks miss it. Set the level and restore it:
58
-
59
- ```typescript
60
- import { logger } from "@rsbuild/core";
61
-
62
- const prev = logger.level;
63
- logger.level = "silent";
64
- try {
65
- await build();
66
- } finally {
67
- logger.level = prev;
68
- }
69
- ```
70
-
71
- ## tsdown / rolldown
72
-
73
- Pass `logLevel: "silent"` to the build call (or inject a no-op output writer).
74
-
75
- ## API Extractor
76
-
77
- Mark diagnostics handled so they are not printed — this is the production quiet
78
- path:
79
-
80
- ```typescript
81
- extractorResult = Extractor.invoke(config, {
82
- messageCallback: (message) => {
83
- message.handled = true;
84
- },
85
- });
86
- ```
87
-
88
- ## See also
89
-
90
- - `vitest-agent://patterns/known-issues-and-caveats` — distinguishing tooling noise from real failures
91
- - `vitest://docs/api/vi` — the `vi.spyOn` / mock API