Skip to content

Commit 860dfd5

Browse files
committed
test: fix test ts errors
1 parent 3bf1fba commit 860dfd5

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

packages/plugin-expo-config-plugins/src/__tests__/pluginExpoConfigPlugins.test.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ async function getTestConfig() {
5555
const iosDirPath = path.join(pluginApi.getProjectRoot(), 'ios');
5656
const androidDirPath = path.join(pluginApi.getProjectRoot(), 'android');
5757

58-
const [appJsonContent, iosDirContent, androidDirContent] = await Promise.all([
59-
fs.readFile(appJsonPath, 'utf-8'),
60-
fs.readdir(iosDirPath),
61-
fs.readdir(androidDirPath),
62-
]);
58+
const [appJsonContent, iosDirContent, androidAppBuildGradleContent] =
59+
await Promise.all([
60+
fs.readFile(appJsonPath, 'utf-8'),
61+
fs.readdir(iosDirPath),
62+
fs.readFile(path.join(androidDirPath, 'app', 'build.gradle'), 'utf-8'),
63+
]);
6364

6465
const { expo, ...rest } = JSON.parse(appJsonContent);
6566
const appJsonConfig = expo || rest;
@@ -68,19 +69,27 @@ async function getTestConfig() {
6869
iosDirContent.find((dir) => dir.includes('.xcodeproj'))?.split('.')[0] ??
6970
'';
7071

71-
const androidProjectName = androidDirContent.find((dir) =>
72-
dir.includes('.gradle'),
73-
)
74-
? 'android'
75-
: '';
72+
const projectPbxprojContent = await fs.readFile(
73+
path.join(iosDirPath, `${iosProjectName}.xcodeproj`, 'project.pbxproj'),
74+
'utf-8',
75+
);
76+
77+
const iosBundleIdentifier =
78+
projectPbxprojContent.match(/PRODUCT_BUNDLE_IDENTIFIER = "(.*)"/)?.[1] ??
79+
'';
80+
81+
const androidPackageName =
82+
androidAppBuildGradleContent.match(/applicationId "(.*)"/)?.[1] ?? '';
7683

7784
const info = {
85+
introspect: false,
7886
projectRoot: pluginApi.getProjectRoot(),
7987
platforms: ['ios', 'android'] as ProjectInfo['platforms'],
8088
packageJsonPath: path.join(pluginApi.getProjectRoot(), 'package.json'),
8189
appJsonPath,
8290
iosProjectName,
83-
androidProjectName,
91+
iosBundleIdentifier,
92+
androidPackageName,
8493
};
8594

8695
return { appJsonConfig, info };

0 commit comments

Comments
 (0)