1- import { deepEqual , equal , fail , throws } from "node:assert/strict" ;
1+ import { deepEqual , equal , fail , ok , throws } from "node:assert/strict" ;
2+ import * as fs from "node:fs" ;
23import { afterEach , before , describe , it } from "node:test" ;
34import { fileURLToPath } from "node:url" ;
45import { generateProject as generateProjectActual } from "../../ios/app.mjs" ;
@@ -9,7 +10,7 @@ import type {
910 JSONObject ,
1011 ProjectConfiguration ,
1112} from "../../scripts/types.ts" ;
12- import { fs , setMockFiles , toJSON } from "../fs.mock.ts" ;
13+ import { fs as mockfs , setMockFiles , toJSON } from "../fs.mock.ts" ;
1314
1415const macosOnly = { skip : process . platform === "win32" } ;
1516
@@ -19,7 +20,7 @@ describe("generateProject()", macosOnly, () => {
1920 platform : ApplePlatform ,
2021 options : JSONObject
2122 ) : ProjectConfiguration {
22- return generateProjectActual ( projectRoot , platform , options , fs ) ;
23+ return generateProjectActual ( projectRoot , platform , options , mockfs ) ;
2324 }
2425
2526 function makeMockProject ( overrides ?: Record < string , unknown > ) {
@@ -158,6 +159,28 @@ describe("generateProject()", macosOnly, () => {
158159 deepEqual ( trimPaths ( result , cwd ) , expected . result ) ;
159160 } ) ;
160161
162+ it ( `[${ platform } ] exports path to Node binary` , ( ) => {
163+ setMockFiles ( makeMockProject ( ) ) ;
164+
165+ generateProject ( platform , platform , { fabricEnabled : true } ) ;
166+ const xcode_env = readTextFile ( `${ platform } /.xcode.env` , mockfs ) ;
167+ const xcode_m = xcode_env . match ( / e x p o r t N O D E _ B I N A R Y = ' ( .* ?) ' / ) ;
168+
169+ ok ( xcode_m ) ;
170+ ok ( xcode_m [ 1 ] . startsWith ( "/" ) ) ;
171+ ok ( fs . existsSync ( xcode_m [ 1 ] ) ) ;
172+
173+ const env = readTextFile (
174+ `node_modules/.generated/${ platform } /.env` ,
175+ mockfs
176+ ) ;
177+ const env_m = env . match ( / e x p o r t P A T H = ' ( .* ?) ' : \$ P A T H / ) ;
178+
179+ ok ( env_m ) ;
180+ ok ( env_m [ 1 ] . startsWith ( "/" ) ) ;
181+ ok ( fs . existsSync ( env_m [ 1 ] ) ) ;
182+ } ) ;
183+
161184 it ( `[${ platform } ] applies build setting overrides` , ( ) => {
162185 setMockFiles ( makeMockProject ( ) ) ;
163186
0 commit comments