mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 04:15:48 -06:00
test: consolidate OpenClaw test state fixtures (#113576)
* test: consolidate OpenClaw test state fixtures * test(plugin-sdk): expose isolated test state Promote the isolated OpenClaw test-state lifecycle through a narrow published Plugin SDK subpath so extension tests no longer import private core helpers. This intentional SDK surface addition is maintainer-approved. * test: use SDK test-state seam in extensions Route bundled extension suites through the focused repo-local Plugin SDK test-state entrypoint and remove the Codex projector harness exports made stale by fixture consolidation. Keep the seam out of production builds and published package artifacts while auditing its real consumers in the full-tree deadcode scan. * test(plugins): map test-state in package boundaries
This commit is contained in:
committed by
GitHub
parent
3d1369ff4f
commit
332006bc1f
@@ -1,6 +1,5 @@
|
||||
// Doctor health contribution tests cover plugin-provided health checks.
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import nodePath from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { DoctorPrompter } from "../commands/doctor-prompter.js";
|
||||
@@ -8,6 +7,7 @@ import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { LEGACY_SECRETREF_ENV_MARKER_PREFIX } from "../config/types.secrets.js";
|
||||
import { migrateLegacySecretRefEnvMarkers } from "../secrets/legacy-secretref-env-marker.js";
|
||||
import { readConfigMachineState } from "../state/config-machine-state.js";
|
||||
import { createOpenClawTestState } from "../test-utils/openclaw-test-state.js";
|
||||
import { CORE_HEALTH_CHECKS } from "./doctor-core-checks.js";
|
||||
import { resolveDoctorContributionHealthChecks } from "./doctor-health-contributions.js";
|
||||
import {
|
||||
@@ -1919,12 +1919,13 @@ describe("doctor health contributions", () => {
|
||||
});
|
||||
|
||||
it("keeps legacy plugin dependency lint opt-in and read-only", async () => {
|
||||
const previousStateDir = process.env.OPENCLAW_STATE_DIR;
|
||||
const tempDir = fs.mkdtempSync(nodePath.join(os.tmpdir(), "openclaw-legacy-plugin-deps-lint-"));
|
||||
const stateDir = nodePath.join(tempDir, "state");
|
||||
const openClawState = await createOpenClawTestState({
|
||||
layout: "state-only",
|
||||
prefix: "openclaw-legacy-plugin-deps-lint-",
|
||||
});
|
||||
const stateDir = openClawState.stateDir;
|
||||
const legacyRuntimeRoot = nodePath.join(stateDir, "plugin-runtime-deps");
|
||||
fs.mkdirSync(legacyRuntimeRoot, { recursive: true });
|
||||
process.env.OPENCLAW_STATE_DIR = stateDir;
|
||||
try {
|
||||
const contributionChecks = await resolveDoctorContributionHealthChecks();
|
||||
const check = contributionChecks.find(
|
||||
@@ -1961,12 +1962,7 @@ describe("doctor health contributions", () => {
|
||||
});
|
||||
expect(fs.existsSync(legacyRuntimeRoot)).toBe(true);
|
||||
} finally {
|
||||
if (previousStateDir === undefined) {
|
||||
delete process.env.OPENCLAW_STATE_DIR;
|
||||
} else {
|
||||
process.env.OPENCLAW_STATE_DIR = previousStateDir;
|
||||
}
|
||||
fs.rmSync(tempDir, { recursive: true, force: true });
|
||||
await openClawState.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user