@@ -30,6 +30,23 @@ async function createStubBinDirectory() {
3030 return { directory, binDirectory, command } ;
3131}
3232
33+ async function stubCurlDownload (
34+ command : ( name : string , body : string ) => Promise < void > ,
35+ tarball : string ,
36+ ) {
37+ await command (
38+ "curl" ,
39+ `out=""
40+ prev=""
41+ for arg in "$@"; do
42+ if [ "$prev" = "-o" ]; then out="$arg"; fi
43+ prev="$arg"
44+ done
45+ [ -n "$out" ]
46+ cp "${ tarball } " "$out"` ,
47+ ) ;
48+ }
49+
3350describe ( "host-native signed OpenTUI smoke counting" , ( ) => {
3451 test ( "release gate separates host-native smoke from opposite-arch signature validation" , async ( ) => {
3552 const source = await readFile ( release , "utf8" ) ;
@@ -40,10 +57,15 @@ describe("host-native signed OpenTUI smoke counting", () => {
4057 expect ( source ) . toContain (
4158 '[ "$validated_macos" -eq 2 ] || die "both macOS architectures must rebuild and pass release validation"' ,
4259 ) ;
60+ expect ( source ) . toContain ( '"macos-arm64|bun-darwin-arm64|macos|-"' ) ;
61+ expect ( source ) . toContain ( '"macos-x64|bun-darwin-x64|macos|-"' ) ;
62+ expect ( source ) . toContain ( '[ "$kind" != macos ] && [ -f "$tarball" ]' ) ;
4363
4464 const sign = source . indexOf ( '"$MACOS_RELEASE_HELPER" sign ' ) ;
4565 const smoke = source . indexOf ( '"$MACOS_HOST_NATIVE_SMOKE" "$label"' ) ;
4666 const notarize = source . indexOf ( '"$MACOS_RELEASE_HELPER" notarize ' ) ;
67+ const extraction = source . indexOf ( 'tar -xzf "$tarball"' ) ;
68+ const checksum = source . indexOf ( 'shasum -a 256 "$pkg.tar.gz"' ) ;
4769 const validated = source . indexOf ( "validated_macos=$((validated_macos + 1))" ) ;
4870 const nativeGate = source . indexOf (
4971 '[ "$native_smoked_macos" -eq 1 ] || die "host-native signed OpenTUI smoke is required before publication"' ,
@@ -52,8 +74,10 @@ describe("host-native signed OpenTUI smoke counting", () => {
5274 expect ( sign ) . toBeGreaterThan ( 0 ) ;
5375 expect ( smoke ) . toBeGreaterThan ( sign ) ;
5476 expect ( notarize ) . toBeGreaterThan ( smoke ) ;
55- expect ( validated ) . toBeGreaterThan ( notarize ) ;
56- expect ( nativeGate ) . toBeGreaterThan ( validated ) ;
77+ expect ( extraction ) . toBeGreaterThan ( notarize ) ;
78+ expect ( validated ) . toBeGreaterThan ( extraction ) ;
79+ expect ( checksum ) . toBeGreaterThan ( validated ) ;
80+ expect ( nativeGate ) . toBeGreaterThan ( checksum ) ;
5781 expect ( publication ) . toBeGreaterThan ( nativeGate ) ;
5882 } ) ;
5983
@@ -112,7 +136,7 @@ describe("OpenTUI native package lockfile integrity", () => {
112136 } ) ;
113137
114138 test ( "mismatched checksum fails before unpack" , async ( ) => {
115- const { directory, binDirectory } = await createStubBinDirectory ( ) ;
139+ const { directory, binDirectory, command } = await createStubBinDirectory ( ) ;
116140 const lockfile = join ( directory , "bun.lock" ) ;
117141 const dest = join ( directory , "node_modules/@opentui/core-darwin-arm64" ) ;
118142 const tarball = join ( directory , "payload.tgz" ) ;
@@ -121,21 +145,7 @@ describe("OpenTUI native package lockfile integrity", () => {
121145 lockfile ,
122146 `{\n "packages": {\n "@opentui/core-darwin-arm64": ["@opentui/core-darwin-arm64@0.5.1", "", {}, "sha512-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],\n }\n}\n` ,
123147 ) ;
124- await writeFile (
125- join ( binDirectory , "curl" ) ,
126- `#!/bin/sh
127- set -eu
128- out=""
129- prev=""
130- for arg in "$@"; do
131- if [ "$prev" = "-o" ]; then out="$arg"; fi
132- prev="$arg"
133- done
134- [ -n "$out" ]
135- cp "${ tarball } " "$out"
136- ` ,
137- ) ;
138- await chmod ( join ( binDirectory , "curl" ) , 0o755 ) ;
148+ await stubCurlDownload ( command , tarball ) ;
139149
140150 const result = Bun . spawnSync ( {
141151 cmd : [ "bash" , fetchOpentui , "core-darwin-arm64" , "0.5.1" , dest , lockfile ] ,
@@ -153,7 +163,7 @@ cp "${tarball}" "$out"
153163 } ) ;
154164
155165 test ( "packages-array hash wins over nested optionalDependencies false match" , async ( ) => {
156- const { directory, binDirectory } = await createStubBinDirectory ( ) ;
166+ const { directory, binDirectory, command } = await createStubBinDirectory ( ) ;
157167 const lockfile = join ( directory , "bun.lock" ) ;
158168 const dest = join ( directory , "node_modules/@opentui/core-darwin-arm64" ) ;
159169 const packageRoot = join ( directory , "package" ) ;
@@ -192,21 +202,7 @@ cp "${tarball}" "$out"
192202}
193203` ,
194204 ) ;
195- await writeFile (
196- join ( binDirectory , "curl" ) ,
197- `#!/bin/sh
198- set -eu
199- out=""
200- prev=""
201- for arg in "$@"; do
202- if [ "$prev" = "-o" ]; then out="$arg"; fi
203- prev="$arg"
204- done
205- [ -n "$out" ]
206- cp "${ tarball } " "$out"
207- ` ,
208- ) ;
209- await chmod ( join ( binDirectory , "curl" ) , 0o755 ) ;
205+ await stubCurlDownload ( command , tarball ) ;
210206
211207 const accept = Bun . spawnSync ( {
212208 cmd : [ "bash" , fetchOpentui , "core-darwin-arm64" , "0.5.1" , dest , lockfile ] ,
0 commit comments