| 123456789101112131415161718192021222324252627282930313233343536373839 |
- import { expect, test } from "bun:test"
- import { execFileSync } from "node:child_process"
- function config(unsigned: boolean) {
- return JSON.parse(
- execFileSync(
- process.execPath,
- [
- "-e",
- `
- import config from "./electron-builder.config.ts";
- import { Arch } from "electron-builder";
- let rejected = false;
- try { await config.beforePack({ electronPlatformName: "other", arch: Arch.arm64 }); }
- catch { rejected = true; }
- console.log(JSON.stringify({ forceCodeSigning: config.forceCodeSigning, rejected }));
- `,
- ],
- {
- cwd: new URL("..", import.meta.url),
- env: {
- ...process.env,
- OPENCODE_CHANNEL: "beta",
- LAMBDA_AGENT_EXTERNAL_SERVICES: "0",
- LAMBDA_AGENT_ALLOW_UNSIGNED: unsigned ? "1" : "0",
- },
- encoding: "utf8",
- },
- ),
- )
- }
- test("release packaging requires signatures on supported platforms and rejects foreign runtimes", () => {
- expect(config(false)).toEqual({ forceCodeSigning: process.platform !== "linux", rejected: true })
- })
- test("explicit internal previews may be unsigned but still require a matching runtime", () => {
- expect(config(true)).toEqual({ forceCodeSigning: false, rejected: true })
- })
|