@vitest-agent/plugin 2.4.9 → 2.5.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/package.json +6 -6
- package/plugin.js +7 -1
- package/utils/ensure-github-reporter.js +24 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest-agent/plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Vitest plugin for the vitest-agent ecosystem: owns persistence, classification, baselines, trends, and dispatches rendering to a configurable reporter.",
|
|
6
6
|
"keywords": [
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@effect/platform-node": "4.0.0-rc.109",
|
|
43
43
|
"@effect/sql-sqlite-node": "4.0.0-rc.109",
|
|
44
|
-
"@effected/workspaces": "^0.18.
|
|
45
|
-
"@vitest-agent/cli": "2.2.
|
|
46
|
-
"@vitest-agent/mcp": "2.4.
|
|
47
|
-
"@vitest-agent/reporter": "2.
|
|
48
|
-
"@vitest-agent/sdk": "2.4.
|
|
44
|
+
"@effected/workspaces": "^0.18.3",
|
|
45
|
+
"@vitest-agent/cli": "2.2.11",
|
|
46
|
+
"@vitest-agent/mcp": "2.4.8",
|
|
47
|
+
"@vitest-agent/reporter": "2.2.0",
|
|
48
|
+
"@vitest-agent/sdk": "2.4.11",
|
|
49
49
|
"effect": "4.0.0-rc.109",
|
|
50
50
|
"magic-string": "^1.2.2"
|
|
51
51
|
},
|
package/plugin.js
CHANGED
|
@@ -5,6 +5,7 @@ import { AgentReporter } from "./reporter.js";
|
|
|
5
5
|
import { buildModuleInfo } from "./utils/build-module-info.js";
|
|
6
6
|
import { DefaultDiscoverStrategy } from "./utils/discover-strategy.js";
|
|
7
7
|
import { discoverProjects } from "./utils/discover-projects.js";
|
|
8
|
+
import { ensureGithubActionsReporter } from "./utils/ensure-github-reporter.js";
|
|
8
9
|
import { injectTags } from "./utils/inject-tags.js";
|
|
9
10
|
import { isBenignViteSourceMapWarning } from "./utils/is-benign-vite-source-map-warning.js";
|
|
10
11
|
import { DEFAULT_BUILT_RECENTLY_MS, DEFAULT_LOCK_STALE_MS, DEFAULT_LOCK_WAIT_TIMEOUT_MS, acquireRunScriptLock, markRunScriptDone, parseLockTimingOverride, releaseRunScriptLock } from "./utils/run-script-lock.js";
|
|
@@ -100,7 +101,7 @@ const aggregatedReporterByVitest = /* @__PURE__ */ new WeakSet();
|
|
|
100
101
|
*
|
|
101
102
|
* @public
|
|
102
103
|
*/
|
|
103
|
-
const CURRENT_PLUGIN_VERSION = "2.
|
|
104
|
+
const CURRENT_PLUGIN_VERSION = "2.5.0";
|
|
104
105
|
const TEST_FILE_DIR_RE = new RegExp(`/(?:${SRC_DIR}|${TEST_DIR})/`);
|
|
105
106
|
const isTestFile = (id) => isTestFileName(id) && TEST_FILE_DIR_RE.test(id);
|
|
106
107
|
/**
|
|
@@ -180,6 +181,11 @@ function AgentPlugin(options = {}, _layer) {
|
|
|
180
181
|
coverageCfg.reporter = [];
|
|
181
182
|
}
|
|
182
183
|
}
|
|
184
|
+
if (env === "ci-github" && consoleMode !== "silent") {
|
|
185
|
+
log("ensuring github-actions reporter is present");
|
|
186
|
+
const withGithubActions = ensureGithubActionsReporter(vitest.config.reporters);
|
|
187
|
+
vitest.config.reporters = withGithubActions;
|
|
188
|
+
}
|
|
183
189
|
const githubActions = env === "ci-github" && consoleMode !== "silent";
|
|
184
190
|
log("githubActions (auto):", githubActions);
|
|
185
191
|
const validation = await Effect.runPromise(Effect.provide(Effect.flatMap(ConfigValidation, (cv) => cv.validate({
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/utils/ensure-github-reporter.ts
|
|
2
|
+
/**
|
|
3
|
+
* Ensure a Vitest `reporters` array contains a `github-actions` entry.
|
|
4
|
+
*
|
|
5
|
+
* @privateRemarks
|
|
6
|
+
* Vitest only auto-appends its built-in `"github-actions"` reporter when
|
|
7
|
+
* the resolved `reporters` array is EMPTY. Once any other reporter is
|
|
8
|
+
* configured (which the plugin always does), that implicit behavior no
|
|
9
|
+
* longer applies, so `AgentPlugin` calls this explicitly under
|
|
10
|
+
* `env === "ci-github"` to guarantee the entry is present.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
function ensureGithubActionsReporter(reporters) {
|
|
15
|
+
if (reporters.some((entry) => {
|
|
16
|
+
if (typeof entry === "string") return entry === "github-actions";
|
|
17
|
+
if (Array.isArray(entry) && typeof entry[0] === "string") return entry[0] === "github-actions";
|
|
18
|
+
return false;
|
|
19
|
+
})) return reporters;
|
|
20
|
+
return [...reporters, ["github-actions", {}]];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ensureGithubActionsReporter };
|