mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-25 17:45:53 +01:00
Isolate OpenCode test configuration from developer state
This commit is contained in:
1 parent
47dfb0eb32
commit
85aaea820a
3 files changed
+31
-3
No files matched your search
@@ -104,12 +104,16 @@ describe("opencode remote execution", () => {
|
||||
const cleanupDirs: string[] = [];
|
||||
const originalOpenCodeAllowAllModels = process.env.OPENCODE_ALLOW_ALL_MODELS;
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
const configHome = await mkdtemp(path.join(os.tmpdir(), "paperclip-opencode-test-config-"));
|
||||
cleanupDirs.push(configHome);
|
||||
vi.stubEnv("XDG_CONFIG_HOME", configHome);
|
||||
delete process.env.OPENCODE_ALLOW_ALL_MODELS;
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
vi.clearAllMocks();
|
||||
vi.unstubAllEnvs();
|
||||
if (originalOpenCodeAllowAllModels === undefined) {
|
||||
delete process.env.OPENCODE_ALLOW_ALL_MODELS;
|
||||
} else {
|
||||
|
||||
@@ -34,6 +34,18 @@ function probeResult(overrides: Record<string, unknown>) {
|
||||
}
|
||||
|
||||
describe("OpenCode local skill injection", () => {
|
||||
let configHome: string;
|
||||
|
||||
beforeEach(async () => {
|
||||
configHome = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-opencode-test-config-"));
|
||||
vi.stubEnv("XDG_CONFIG_HOME", configHome);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
vi.unstubAllEnvs();
|
||||
await fs.rm(configHome, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it("injects runtime skills into the configured child HOME", async () => {
|
||||
const root = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-opencode-configured-home-"));
|
||||
const processHome = path.join(root, "process-home");
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { mkdtemp, rm } from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { AdapterExecutionTarget } from "@paperclipai/adapter-utils/execution-target";
|
||||
|
||||
const {
|
||||
@@ -71,8 +74,17 @@ vi.mock("@paperclipai/adapter-utils/execution-target", async () => {
|
||||
import { testEnvironment } from "./test.js";
|
||||
|
||||
describe("opencode remote environment diagnostics", () => {
|
||||
afterEach(() => {
|
||||
let configHome: string;
|
||||
|
||||
beforeEach(async () => {
|
||||
configHome = await mkdtemp(path.join(os.tmpdir(), "paperclip-opencode-test-config-"));
|
||||
vi.stubEnv("XDG_CONFIG_HOME", configHome);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
vi.clearAllMocks();
|
||||
vi.unstubAllEnvs();
|
||||
await rm(configHome, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it("stages remote runtime config assets for sandbox hello probes", async () => {
|
||||
|
||||
Reference in new issue
Block a user