@@ -96,12 +96,13 @@ import { symlinksSupported } from "@t3tools/shared/testing/symlinks";
9696
9797// A minimal stand-in for the Linux CLI release archive: one top-level
9898// directory named after the archive stem holding the executable, the web
99- // client, and the runtime externals with node-pty built from source .
99+ // client, and the runtime externals with node-pty's prebuilt binary .
100100const makeLinuxCliArchiveFixture = Effect . fn ( "test.makeLinuxCliArchiveFixture" ) ( function * ( input : {
101101 readonly root : string ;
102102 readonly stem : string ;
103103 readonly extraMembers ?: ReadonlyArray < string > ;
104104 readonly omitMembers ?: ReadonlyArray < string > ;
105+ readonly ptyMember ?: string ;
105106} ) {
106107 const fs = yield * FileSystem . FileSystem ;
107108 const path = yield * Path . Path ;
@@ -111,7 +112,7 @@ const makeLinuxCliArchiveFixture = Effect.fn("test.makeLinuxCliArchiveFixture")(
111112 `${ input . stem } /t3` ,
112113 `${ input . stem } /client/index.html` ,
113114 `${ input . stem } /node_modules/node-pty/package.json` ,
114- `${ input . stem } /node_modules/node-pty/build/Release /pty.node` ,
115+ `${ input . stem } /node_modules/node-pty/${ input . ptyMember ?? "prebuilds/linux-x64 /pty.node" } ` ,
115116 ...( input . extraMembers ?? [ ] ) ,
116117 ] . filter ( ( member ) => ! ( input . omitMembers ?? [ ] ) . includes ( member ) ) ;
117118 for ( const member of members ) {
@@ -174,7 +175,12 @@ const WINDOWS_PAYLOAD_FIXTURE_VERSION = "1.2.3";
174175const makeWindowsPayloadFixture = Effect . fn ( "test.makeWindowsPayloadFixture" ) ( function * ( input : {
175176 readonly copyUnpackedNatives : boolean ;
176177 readonly serverEntrySource ?: string ;
177- readonly wslRuntime ?: "valid" | "loose-server-tree" | "missing-pty" | "bad-digest" ;
178+ readonly wslRuntime ?:
179+ | "valid"
180+ | "source-built-pty"
181+ | "loose-server-tree"
182+ | "missing-pty"
183+ | "bad-digest" ;
178184} ) {
179185 const fs = yield * FileSystem . FileSystem ;
180186 const path = yield * Path . Path ;
@@ -227,7 +233,10 @@ const makeWindowsPayloadFixture = Effect.fn("test.makeWindowsPayloadFixture")(fu
227233 root : path . join ( tempDir , "wsl-runtime" ) ,
228234 stem,
229235 ...( input . wslRuntime === "missing-pty"
230- ? { omitMembers : [ `${ stem } /node_modules/node-pty/build/Release/pty.node` ] }
236+ ? { omitMembers : [ `${ stem } /node_modules/node-pty/prebuilds/linux-x64/pty.node` ] }
237+ : { } ) ,
238+ ...( input . wslRuntime === "source-built-pty"
239+ ? { ptyMember : "build/Release/pty.node" }
231240 : { } ) ,
232241 } ) ;
233242 const archivePath = path . join ( resourcesDir , WSL_RUNTIME_ARCHIVE_NAME ) ;
@@ -1266,6 +1275,24 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
12661275 ) ,
12671276 ) ;
12681277
1278+ it . effect ( "accepts an embedded archive with a source-built node-pty binary" , ( ) =>
1279+ Effect . scoped (
1280+ Effect . gen ( function * ( ) {
1281+ const fixture = yield * makeWindowsPayloadFixture ( {
1282+ copyUnpackedNatives : true ,
1283+ wslRuntime : "source-built-pty" ,
1284+ } ) ;
1285+ yield * validateWindowsPackagedPayload ( {
1286+ stageDistDir : fixture . stageDistDir ,
1287+ appExecutableName : fixture . appExecutableName ,
1288+ targetArch : "x64" ,
1289+ appVersion : WINDOWS_PAYLOAD_FIXTURE_VERSION ,
1290+ expectWslRuntime : true ,
1291+ } ) ;
1292+ } ) ,
1293+ ) ,
1294+ ) ;
1295+
12691296 it . effect ( "rejects an embedded archive without the Linux node-pty binary" , ( ) =>
12701297 Effect . scoped (
12711298 Effect . gen ( function * ( ) {
@@ -1284,7 +1311,7 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
12841311 assert . instanceOf ( error , WindowsPackagedPayloadValidationError ) ;
12851312 assert . equal ( error . reason , "wsl-runtime-invalid" ) ;
12861313 assert . deepStrictEqual ( error . missingFiles , [
1287- `${ wslRuntimeArchiveStem ( WINDOWS_PAYLOAD_FIXTURE_VERSION , "x64" ) } /node_modules/node-pty/build/Release /pty.node` ,
1314+ `${ wslRuntimeArchiveStem ( WINDOWS_PAYLOAD_FIXTURE_VERSION , "x64" ) } /node_modules/node-pty/prebuilds/linux-x64 /pty.node` ,
12881315 ] ) ;
12891316 } ) ,
12901317 ) ,
0 commit comments