feat: make playwright optional
CI / verify (pull_request) Successful in 8s

This commit is contained in:
2026-09-15 10:18:43 +02:00
parent 1bc5c329a8
commit f6cae21bfa
8 changed files with 93 additions and 14 deletions
+17 -2
View File
@@ -44,7 +44,11 @@ async function run(command: string[], cwd: string, env: NodeJS.ProcessEnv) {
return { exitCode, stdout, stderr };
}
async function install(mode: "native" | "checksum" | "legacy", configured = false) {
async function install(
mode: "native" | "checksum" | "legacy",
configured = false,
playwright = false,
) {
const directory = await mkdtemp(join(tmpdir(), "stanp-install-"));
directories.push(directory);
const config =
@@ -187,7 +191,11 @@ exec sha256sum "$@"
),
]);
await Promise.all([chmod(join(bin, "curl"), 0o755), chmod(join(bin, "sha256sum"), 0o755)]);
const result = await run(["bash", installer], directory, env);
const result = await run(
["bash", installer, ...(playwright ? ["--playwright"] : [])],
directory,
env,
);
return { directory, config, env, result };
}
@@ -249,6 +257,13 @@ test("preserves an existing stanp-opencode configuration", async () => {
expect(installed.permissions).toEqual(jsonConfig.permissions);
}, 60_000);
test("enables Playwright only when requested", async () => {
const { config, result } = await install("native", false, true);
expect(result, result.stderr).toMatchObject({ exitCode: 0 });
const installed = JSON.parse(await readFile(join(config, "opencode.json"), "utf8"));
expect(installed.plugins.at(-1).options.playwright).toBe(true);
}, 60_000);
for (const mode of ["checksum", "legacy"] as const) {
test(`${mode} failure preserves the installed plugin in a custom path containing spaces`, async () => {
const { directory, config, env, result } = await install(mode);