This commit is contained in:
+17
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user