@@ -0,0 +1,3 @@
|
|||||||
|
# CI-safe tests and scripts
|
||||||
|
|
||||||
|
Do not assume local directories, files, tools, or generated artifacts exist in a clean CI environment. In particular, `/tmp/opencode` is an agent-environment convenience, not a CI guarantee. Tests should create temporary directories with `node:os` `tmpdir()` and `mkdtemp(join(tmpdir(), prefix))`, explicitly create required parent directories and fixtures, and clean up the files they create.
|
||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
symlink,
|
symlink,
|
||||||
writeFile,
|
writeFile,
|
||||||
} from "node:fs/promises";
|
} from "node:fs/promises";
|
||||||
|
import { tmpdir } from "node:os";
|
||||||
import { dirname, join } from "node:path";
|
import { dirname, join } from "node:path";
|
||||||
import { createHash } from "node:crypto";
|
import { createHash } from "node:crypto";
|
||||||
import { install } from "../scripts/install.js";
|
import { install } from "../scripts/install.js";
|
||||||
@@ -56,7 +57,7 @@ async function run(
|
|||||||
return { exitCode, stdout, stderr };
|
return { exitCode, stdout, stderr };
|
||||||
}
|
}
|
||||||
async function fixture() {
|
async function fixture() {
|
||||||
const directory = await mkdtemp("/tmp/opencode/plugin-install-");
|
const directory = await mkdtemp(join(tmpdir(), "plugin-install-"));
|
||||||
directories.push(directory);
|
directories.push(directory);
|
||||||
const source = join(directory, "package with spaces");
|
const source = join(directory, "package with spaces");
|
||||||
const config = join(directory, "config with spaces");
|
const config = join(directory, "config with spaces");
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import { expect, test } from "bun:test";
|
import { expect, test } from "bun:test";
|
||||||
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
||||||
|
import { tmpdir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { Host } from "@opencode/plugin/host";
|
import { Host } from "@opencode/plugin/host";
|
||||||
import { build } from "../scripts/build.js";
|
import { build } from "../scripts/build.js";
|
||||||
import { install } from "../scripts/install.js";
|
import { install } from "../scripts/install.js";
|
||||||
|
|
||||||
test("packed package has independent native plugins and quota-only TUI discovery", async () => {
|
test("packed package has independent native plugins and quota-only TUI discovery", async () => {
|
||||||
const directory = await mkdtemp("/tmp/opencode/plugin-package-");
|
const directory = await mkdtemp(join(tmpdir(), "plugin-package-"));
|
||||||
try {
|
try {
|
||||||
await build();
|
await build();
|
||||||
const archive = join(directory, "stanp-opencode.tgz");
|
const archive = join(directory, "stanp-opencode.tgz");
|
||||||
|
|||||||
Reference in New Issue
Block a user