
















1+// iOS release wrapper tests keep release args fail-closed before Fastlane work.
2+import { execFileSync } from "node:child_process";
3+import path from "node:path";
4+import { describe, expect, it } from "vitest";
5+6+const BASH_BIN = process.platform === "win32" ? "bash" : "/bin/bash";
7+8+type WrapperCase = readonly [scriptPath: string, args: readonly string[], option: string];
9+10+function runScript(
11+scriptPath: string,
12+args: readonly string[],
13+): { ok: boolean; stdout: string; stderr: string } {
14+const scriptArgs =
15+process.platform === "win32" ? [scriptPath] : ["--noprofile", "--norc", scriptPath];
16+try {
17+const stdout = execFileSync(BASH_BIN, [...scriptArgs, ...args], {
18+cwd: process.cwd(),
19+encoding: "utf8",
20+stdio: ["ignore", "pipe", "pipe"],
21+});
22+return { ok: true, stdout, stderr: "" };
23+} catch (error) {
24+const e = error as { stdout?: unknown; stderr?: unknown };
25+const stdout = Buffer.isBuffer(e.stdout) ? e.stdout.toString("utf8") : String(e.stdout ?? "");
26+const stderr = Buffer.isBuffer(e.stderr) ? e.stderr.toString("utf8") : String(e.stderr ?? "");
27+return { ok: false, stdout, stderr };
28+}
29+}
30+31+describe("iOS release shell wrapper arguments", () => {
32+const missingValueCases: readonly WrapperCase[] = [
33+["scripts/ios-release-upload.sh", ["--build-number", "--bogus"], "--build-number"],
34+["scripts/ios-release-archive.sh", ["--build-number", "--bogus"], "--build-number"],
35+["scripts/ios-release-prepare.sh", ["--build-number", "--team-id"], "--build-number"],
36+[
37+"scripts/ios-release-prepare.sh",
38+["--build-number", "7", "--team-id", "--bogus"],
39+"--team-id",
40+],
41+];
42+43+it.each(missingValueCases)(
44+"rejects missing %s option values before release work",
45+(scriptPath, args, option) => {
46+const result = runScript(path.join(process.cwd(), scriptPath), args);
47+48+expect(result.ok).toBe(false);
49+expect(result.stderr).toContain(`Missing value for ${option}.`);
50+expect(result.stderr).not.toContain("No such file or directory");
51+expect(result.stderr).not.toContain("fastlane");
52+expect(result.stdout).toBe("");
53+},
54+);
55+});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。