Repository: microsoft/react-native-test-app
Pull request #790 (2022-03-04 14:21:34)

fix: helper functions to help declutter `react-native.config.js`
### Description

Introduce helper functions to help declutter `react-native.config.js`

### Platforms affected

- [x] Android
- [x] iOS
- [x] macOS
- [x] Windows

### Test plan

CI should pass.


Patch:
diff --git a/example/android/gradle.properties b/example/android/gradle.properties
index 771053d..763997a 100644
--- a/example/android/gradle.properties
+++ b/example/android/gradle.properties
@@ -3,6 +3,7 @@
 # IDE (e.g. Android Studio) users:
 # Gradle settings configured through the IDE *will override*
 # any settings specified in this file.
+
 # For more details on how to configure your build environment visit
 # http://www.gradle.org/docs/current/userguide/build_environment.html
 
diff --git a/example/react-native.config.js b/example/react-native.config.js
index e9f5be2..262d4b8 100644
--- a/example/react-native.config.js
+++ b/example/react-native.config.js
@@ -1,61 +1,24 @@
 const fs = require("fs");
 const path = require("path");
-
-const windowsProjectFile = path.join(
-  "node_modules",
-  ".generated",
-  "windows",
-  "ReactTestApp",
-  "ReactTestApp.vcxproj"
-);
+const {
+  androidManifestPath,
+  iosProjectPath,
+  windowsProjectPath,
+} = require("react-native-test-app");
 
 module.exports = {
   project: {
     android: {
       sourceDir: "android",
-      manifestPath: path.relative(
-        path.join(__dirname, "android"),
-        path.join(
-          path.dirname(require.resolve("react-native-test-app/package.json")),
-          "android",
-          "app",
-          "src",
-          "main",
-          "AndroidManifest.xml"
-        )
-      ),
+      manifestPath: androidManifestPath(path.join(__dirname, "android")),
     },
     ios: {
-      project: (() => {
-        const {
-          packageSatisfiesVersionRange,
-        } = require("react-native-test-app/scripts/configure");
-        if (
-          packageSatisfiesVersionRange(
-            "@react-native-community/cli-platform-ios",
-            "<5.0.2"
-          )
-        ) {
-          // Prior to @react-native-community/cli-platform-ios v5.0.0,
-          // `project` was only used to infer `sourceDir` and `podfile`.
-          return "ios/ReactTestApp-Dummy.xcodeproj";
-        }
-
-        // `sourceDir` and `podfile` detection was fixed in
-        // @react-native-community/cli-platform-ios v5.0.2 (see
-        // https://github.com/react-native-community/cli/pull/1444).
-        return "node_modules/.generated/ios/ReactTestApp.xcodeproj";
-      })(),
+      project: iosProjectPath("ios"),
     },
-    windows: fs.existsSync(windowsProjectFile) && {
+    windows: fs.existsSync("windows/Example.sln") && {
       sourceDir: "windows",
       solutionFile: "Example.sln",
-      project: {
-        projectFile: path.relative(
-          path.join(__dirname, "windows"),
-          windowsProjectFile
-        ),
-      },
+      project: windowsProjectPath(path.join(__dirname, "windows")),
     },
   },
 };
diff --git a/package.json b/package.json
index 550f623..1837a31 100644
--- a/package.json
+++ b/package.json
@@ -39,6 +39,7 @@
     "/windows/*.{js,props,sln}",
     "/windows/ReactTestApp"
   ],
+  "main": "scripts/configure.js",
   "bin": {
     "configure-test-app": "scripts/configure.js",
     "init-test-app": "scripts/init.js",
diff --git a/scripts/configure.js b/scripts/configure.js
index e44de04..bc55c16 100755
--- a/scripts/configure.js
+++ b/scripts/configure.js
@@ -213,6 +213,64 @@ function getPlatformPackage(packageName, targetVersion) {
   return { [packageName]: `^${v.major}.${v.minor}.0` };
 }
 
+/**
+ * @param {string} sourceDir
+ * @returns {string}
+ */
+function androidManifestPath(sourceDir) {
+  return path.relative(
+    sourceDir,
+    path.join(
+      path.dirname(require.resolve("../package.json")),
+      "android",
+      "app",
+      "src",
+      "main",
+      "AndroidManifest.xml"
+    )
+  );
+}
+
+/**
+ * @param {string} sourceDir
+ * @returns {string}
+ */
+function iosProjectPath(sourceDir) {
+  const useOldWorkaround = packageSatisfiesVersionRange(
+    "@react-native-community/cli-platform-ios",
+    "<5.0.2"
+  );
+  if (useOldWorkaround) {
+    // Prior to @react-native-community/cli-platform-ios v5.0.0, `project` was
+    // only used to infer `sourceDir` and `podfile`.
+    return path.join(sourceDir, "ReactTestApp-Dummy.xcodeproj");
+  }
+
+  // `sourceDir` and `podfile` detection was fixed in
+  // @react-native-community/cli-platform-ios v5.0.2 (see
+  // https://github.com/react-native-community/cli/pull/1444).
+  return "node_modules/.generated/ios/ReactTestApp.xcodeproj";
+}
+
+/**
+ * @param {string} sourceDir
+ * @returns {{ projectFile: string }}
+ */
+function windowsProjectPath(sourceDir) {
+  return {
+    projectFile: path.relative(
+      sourceDir,
+      path.join(
+        "node_modules",
+        ".generated",
+        "windows",
+        "ReactTestApp",
+        "ReactTestApp.vcxproj"
+      )
+    ),
+  };
+}
+
 /**
  * Returns the appropriate `react-native.config.js` for specified parameters.
  * @param {ConfigureParams} params
@@ -224,22 +282,12 @@ function reactNativeConfig({ name, testAppPath, platforms, flatten }) {
     switch (platforms[0]) {
       case "android":
         return join(
-          'const path = require("path");',
+          'const { androidManifestPath } = require("react-native-test-app");',
           "module.exports = {",
           "  project: {",
           "    android: {",
           '      sourceDir: ".",',
-          "      manifestPath: path.relative(",
-          "        __dirname,",
-          "        path.join(",
-          '          path.dirname(require.resolve("react-native-test-app/package.json")),',
-          '          "android",',
-          '          "app",',
-          '          "src",',
-          '          "main",',
-          '          "AndroidManifest.xml"',
-          "        )",
-          "      ),",
+          "      manifestPath: androidManifestPath(__dirname),",
           "    },",
           "  },",
           "};",
@@ -249,18 +297,11 @@ function reactNativeConfig({ name, testAppPath, platforms, flatten }) {
       case "macos":
       case "ios":
         return join(
-          "const {",
-          "  packageSatisfiesVersionRange,",
-          '} = require("react-native-test-app/scripts/configure");',
+          'const { iosProjectPath } = require("react-native-test-app");',
           "module.exports = {",
           "  project: {",
           "    ios: {",
-          "      project: packageSatisfiesVersionRange(",
-          '        "@react-native-community/cli-platform-ios",',
-          '        "<5.0.2"',
-          "      )",
-          '        ? "ReactTestApp-Dummy.xcodeproj"',
-          '        : "node_modules/.generated/ios/ReactTestApp.xcodeproj",',
+          '      project: iosProjectPath("."),',
           "    }",
           "  }",
           "};",
@@ -270,6 +311,7 @@ function reactNativeConfig({ name, testAppPath, platforms, flatten }) {
       case "windows":
         return join(
           'const path = require("path");',
+          'const { windowsProjectPath } = require("react-native-test-app");',
           "",
           'const sourceDir = "windows";',
           "module.exports = {",
@@ -277,18 +319,7 @@ function reactNativeConfig({ name, testAppPath, platforms, flatten }) {
           "    windows: {",
           "      sourceDir,",
           `      solutionFile: "${name}.sln",`,
-          "      project: {",
-          "        projectFile: path.relative(",
-          "          path.join(__dirname, sourceDir),",
-          "          path.join(",
-          '            "node_modules",',
-          '            ".generated",',
-          '            "windows",',
-          '            "ReactTestApp",',
-          '            "ReactTestApp.vcxproj"',
-          "          )",
-          "        ),",
-          "      },",
+          "      project: windowsProjectPath(path.join(__dirname, sourceDir)),",
           "    },",
           "  },",
           '  reactNativePath: "node_modules/react-native-windows",',
@@ -902,7 +933,7 @@ if (require.main === module) {
       const result = configure({
         name: typeof name === "string" && name ? name : getAppName(packagePath),
         packagePath,
-        testAppPath: path.resolve(__dirname, ".."),
+        testAppPath: path.dirname(require.resolve("../package.json")),
         targetVersion,
         platforms,
         flatten,
@@ -916,12 +947,14 @@ if (require.main === module) {
   ).argv;
 }
 
+exports.androidManifestPath = androidManifestPath;
 exports.configure = configure;
 exports.error = error;
 exports.gatherConfig = gatherConfig;
 exports.getAppName = getAppName;
 exports.getConfig = getConfig;
 exports.getPlatformPackage = getPlatformPackage;
+exports.iosProjectPath = iosProjectPath;
 exports.isDestructive = isDestructive;
 exports.isInstalled = isInstalled;
 exports.join = join;
@@ -934,4 +967,5 @@ exports.removeAllFiles = removeAllFiles;
 exports.sortByKeys = sortByKeys;
 exports.updatePackageManifest = updatePackageManifest;
 exports.warn = warn;
+exports.windowsProjectPath = windowsProjectPath;
 exports.writeAllFiles = writeAllFiles;


Test patch:
diff --git a/test/configure/__snapshots__/gatherConfig.test.js.snap b/test/configure/__snapshots__/gatherConfig.test.js.snap
index 0070e83..0eeeece 100644
--- a/test/configure/__snapshots__/gatherConfig.test.js.snap
+++ b/test/configure/__snapshots__/gatherConfig.test.js.snap
@@ -24,18 +24,11 @@ use_test_app!
     "metro.config.js": Object {
       "source": "example/metro.config.js",
     },
-    "react-native.config.js": "const {
-  packageSatisfiesVersionRange,
-} = require(\\"react-native-test-app/scripts/configure\\");
+    "react-native.config.js": "const { iosProjectPath } = require(\\"react-native-test-app\\");
 module.exports = {
   project: {
     ios: {
-      project: packageSatisfiesVersionRange(
-        \\"@react-native-community/cli-platform-ios\\",
-        \\"<5.0.2\\"
-      )
-        ? \\"ReactTestApp-Dummy.xcodeproj\\"
-        : \\"node_modules/.generated/ios/ReactTestApp.xcodeproj\\",
+      project: iosProjectPath(\\".\\"),
     }
   }
 };
@@ -135,62 +128,25 @@ use_test_app!
     },
     "react-native.config.js": "const fs = require(\\"fs\\");
 const path = require(\\"path\\");
-
-const windowsProjectFile = path.join(
-  \\"node_modules\\",
-  \\".generated\\",
-  \\"windows\\",
-  \\"ReactTestApp\\",
-  \\"ReactTestApp.vcxproj\\"
-);
+const {
+  androidManifestPath,
+  iosProjectPath,
+  windowsProjectPath,
+} = require(\\"react-native-test-app\\");
 
 module.exports = {
   project: {
     android: {
       sourceDir: \\"android\\",
-      manifestPath: path.relative(
-        path.join(__dirname, \\"android\\"),
-        path.join(
-          path.dirname(require.resolve(\\"react-native-test-app/package.json\\")),
-          \\"android\\",
-          \\"app\\",
-          \\"src\\",
-          \\"main\\",
-          \\"AndroidManifest.xml\\"
-        )
-      ),
+      manifestPath: androidManifestPath(path.join(__dirname, \\"android\\")),
     },
     ios: {
-      project: (() => {
-        const {
-          packageSatisfiesVersionRange,
-        } = require(\\"react-native-test-app/scripts/configure\\");
-        if (
-          packageSatisfiesVersionRange(
-            \\"@react-native-community/cli-platform-ios\\",
-            \\"<5.0.2\\"
-          )
-        ) {
-          // Prior to @react-native-community/cli-platform-ios v5.0.0,
-          // \`project\` was only used to infer \`sourceDir\` and \`podfile\`.
-          return \\"ios/ReactTestApp-Dummy.xcodeproj\\";
-        }
-
-        // \`sourceDir\` and \`podfile\` detection was fixed in
-        // @react-native-community/cli-platform-ios v5.0.2 (see
-        // https://github.com/react-native-community/cli/pull/1444).
-        return \\"node_modules/.generated/ios/ReactTestApp.xcodeproj\\";
-      })(),
+      project: iosProjectPath(\\"ios\\"),
     },
-    windows: fs.existsSync(windowsProjectFile) && {
+    windows: fs.existsSync(\\"windows/Test.sln\\") && {
       sourceDir: \\"windows\\",
       solutionFile: \\"Test.sln\\",
-      project: {
-        projectFile: path.relative(
-          path.join(__dirname, \\"windows\\"),
-          windowsProjectFile
-        ),
-      },
+      project: windowsProjectPath(path.join(__dirname, \\"windows\\")),
     },
   },
 };
@@ -239,62 +195,25 @@ Object {
     },
     "common/react-native.config.js": "const fs = require(\\"fs\\");
 const path = require(\\"path\\");
-
-const windowsProjectFile = path.join(
-  \\"node_modules\\",
-  \\".generated\\",
-  \\"windows\\",
-  \\"ReactTestApp\\",
-  \\"ReactTestApp.vcxproj\\"
-);
+const {
+  androidManifestPath,
+  iosProjectPath,
+  windowsProjectPath,
+} = require(\\"react-native-test-app\\");
 
 module.exports = {
   project: {
     android: {
       sourceDir: \\"android\\",
-      manifestPath: path.relative(
-        path.join(__dirname, \\"android\\"),
-        path.join(
-          path.dirname(require.resolve(\\"react-native-test-app/package.json\\")),
-          \\"android\\",
-          \\"app\\",
-          \\"src\\",
-          \\"main\\",
-          \\"AndroidManifest.xml\\"
-        )
-      ),
+      manifestPath: androidManifestPath(path.join(__dirname, \\"android\\")),
     },
     ios: {
-      project: (() => {
-        const {
-          packageSatisfiesVersionRange,
-        } = require(\\"react-native-test-app/scripts/configure\\");
-        if (
-          packageSatisfiesVersionRange(
-            \\"@react-native-community/cli-platform-ios\\",
-            \\"<5.0.2\\"
-          )
-        ) {
-          // Prior to @react-native-community/cli-platform-ios v5.0.0,
-          // \`project\` was only used to infer \`sourceDir\` and \`podfile\`.
-          return \\"ios/ReactTestApp-Dummy.xcodeproj\\";
-        }
-
-        // \`sourceDir\` and \`podfile\` detection was fixed in
-        // @react-native-community/cli-platform-ios v5.0.2 (see
-        // https://github.com/react-native-community/cli/pull/1444).
-        return \\"node_modules/.generated/ios/ReactTestApp.xcodeproj\\";
-      })(),
+      project: iosProjectPath(\\"ios\\"),
     },
-    windows: fs.existsSync(windowsProjectFile) && {
+    windows: fs.existsSync(\\"windows/Test.sln\\") && {
       sourceDir: \\"windows\\",
       solutionFile: \\"Test.sln\\",
-      project: {
-        projectFile: path.relative(
-          path.join(__dirname, \\"windows\\"),
-          windowsProjectFile
-        ),
-      },
+      project: windowsProjectPath(path.join(__dirname, \\"windows\\")),
     },
   },
 };
@@ -304,62 +223,25 @@ module.exports = {
     },
     "react-native.config.js": "const fs = require(\\"fs\\");
 const path = require(\\"path\\");
-
-const windowsProjectFile = path.join(
-  \\"node_modules\\",
-  \\".generated\\",
-  \\"windows\\",
-  \\"ReactTestApp\\",
-  \\"ReactTestApp.vcxproj\\"
-);
+const {
+  androidManifestPath,
+  iosProjectPath,
+  windowsProjectPath,
+} = require(\\"react-native-test-app\\");
 
 module.exports = {
   project: {
     android: {
       sourceDir: \\"android\\",
-      manifestPath: path.relative(
-        path.join(__dirname, \\"android\\"),
-        path.join(
-          path.dirname(require.resolve(\\"react-native-test-app/package.json\\")),
-          \\"android\\",
-          \\"app\\",
-          \\"src\\",
-          \\"main\\",
-          \\"AndroidManifest.xml\\"
-        )
-      ),
+      manifestPath: androidManifestPath(path.join(__dirname, \\"android\\")),
     },
     ios: {
-      project: (() => {
-        const {
-          packageSatisfiesVersionRange,
-        } = require(\\"react-native-test-app/scripts/configure\\");
-        if (
-          packageSatisfiesVersionRange(
-            \\"@react-native-community/cli-platform-ios\\",
-            \\"<5.0.2\\"
-          )
-        ) {
-          // Prior to @react-native-community/cli-platform-ios v5.0.0,
-          // \`project\` was only used to infer \`sourceDir\` and \`podfile\`.
-          return \\"ios/ReactTestApp-Dummy.xcodeproj\\";
-        }
-
-        // \`sourceDir\` and \`podfile\` detection was fixed in
-        // @react-native-community/cli-platform-ios v5.0.2 (see
-        // https://github.com/react-native-community/cli/pull/1444).
-        return \\"node_modules/.generated/ios/ReactTestApp.xcodeproj\\";
-      })(),
+      project: iosProjectPath(\\"ios\\"),
     },
-    windows: fs.existsSync(windowsProjectFile) && {
+    windows: fs.existsSync(\\"windows/Test.sln\\") && {
       sourceDir: \\"windows\\",
       solutionFile: \\"Test.sln\\",
-      project: {
-        projectFile: path.relative(
-          path.join(__dirname, \\"windows\\"),
-          windowsProjectFile
-        ),
-      },
+      project: windowsProjectPath(path.join(__dirname, \\"windows\\")),
     },
   },
 };
@@ -398,62 +280,25 @@ use_test_app!
     },
     "react-native.config.js": "const fs = require(\\"fs\\");
 const path = require(\\"path\\");
-
-const windowsProjectFile = path.join(
-  \\"node_modules\\",
-  \\".generated\\",
-  \\"windows\\",
-  \\"ReactTestApp\\",
-  \\"ReactTestApp.vcxproj\\"
-);
+const {
+  androidManifestPath,
+  iosProjectPath,
+  windowsProjectPath,
+} = require(\\"react-native-test-app\\");
 
 module.exports = {
   project: {
     android: {
       sourceDir: \\"android\\",
-      manifestPath: path.relative(
-        path.join(__dirname, \\"android\\"),
-        path.join(
-          path.dirname(require.resolve(\\"react-native-test-app/package.json\\")),
-          \\"android\\",
-          \\"app\\",
-          \\"src\\",
-          \\"main\\",
-          \\"AndroidManifest.xml\\"
-        )
-      ),
+      manifestPath: androidManifestPath(path.join(__dirname, \\"android\\")),
     },
     ios: {
-      project: (() => {
-        const {
-          packageSatisfiesVersionRange,
-        } = require(\\"react-native-test-app/scripts/configure\\");
-        if (
-          packageSatisfiesVersionRange(
-            \\"@react-native-community/cli-platform-ios\\",
-            \\"<5.0.2\\"
-          )
-        ) {
-          // Prior to @react-native-community/cli-platform-ios v5.0.0,
-          // \`project\` was only used to infer \`sourceDir\` and \`podfile\`.
-          return \\"ios/ReactTestApp-Dummy.xcodeproj\\";
-        }
-
-        // \`sourceDir\` and \`podfile\` detection was fixed in
-        // @react-native-community/cli-platform-ios v5.0.2 (see
-        // https://github.com/react-native-community/cli/pull/1444).
-        return \\"node_modules/.generated/ios/ReactTestApp.xcodeproj\\";
-      })(),
+      project: iosProjectPath(\\"ios\\"),
     },
-    windows: fs.existsSync(windowsProjectFile) && {
+    windows: fs.existsSync(\\"windows/Test.sln\\") && {
       sourceDir: \\"windows\\",
       solutionFile: \\"Test.sln\\",
-      project: {
-        projectFile: path.relative(
-          path.join(__dirname, \\"windows\\"),
-          windowsProjectFile
-        ),
-      },
+      project: windowsProjectPath(path.join(__dirname, \\"windows\\")),
     },
   },
 };
@@ -562,62 +407,25 @@ use_test_app!
     },
     "react-native.config.js": "const fs = require(\\"fs\\");
 const path = require(\\"path\\");
-
-const windowsProjectFile = path.join(
-  \\"node_modules\\",
-  \\".generated\\",
-  \\"windows\\",
-  \\"ReactTestApp\\",
-  \\"ReactTestApp.vcxproj\\"
-);
+const {
+  androidManifestPath,
+  iosProjectPath,
+  windowsProjectPath,
+} = require(\\"react-native-test-app\\");
 
 module.exports = {
   project: {
     android: {
       sourceDir: \\"android\\",
-      manifestPath: path.relative(
-        path.join(__dirname, \\"android\\"),
-        path.join(
-          path.dirname(require.resolve(\\"react-native-test-app/package.json\\")),
-          \\"android\\",
-          \\"app\\",
-          \\"src\\",
-          \\"main\\",
-          \\"AndroidManifest.xml\\"
-        )
-      ),
+      manifestPath: androidManifestPath(path.join(__dirname, \\"android\\")),
     },
     ios: {
-      project: (() => {
-        const {
-          packageSatisfiesVersionRange,
-        } = require(\\"react-native-test-app/scripts/configure\\");
-        if (
-          packageSatisfiesVersionRange(
-            \\"@react-native-community/cli-platform-ios\\",
-            \\"<5.0.2\\"
-          )
-        ) {
-          // Prior to @react-native-community/cli-platform-ios v5.0.0,
-          // \`project\` was only used to infer \`sourceDir\` and \`podfile\`.
-          return \\"ios/ReactTestApp-Dummy.xcodeproj\\";
-        }
-
-        // \`sourceDir\` and \`podfile\` detection was fixed in
-        // @react-native-community/cli-platform-ios v5.0.2 (see
-        // https://github.com/react-native-community/cli/pull/1444).
-        return \\"node_modules/.generated/ios/ReactTestApp.xcodeproj\\";
-      })(),
+      project: iosProjectPath(\\"ios\\"),
     },
-    windows: fs.existsSync(windowsProjectFile) && {
+    windows: fs.existsSync(\\"windows/Test.sln\\") && {
       sourceDir: \\"windows\\",
       solutionFile: \\"Test.sln\\",
-      project: {
-        projectFile: path.relative(
-          path.join(__dirname, \\"windows\\"),
-          windowsProjectFile
-        ),
-      },
+      project: windowsProjectPath(path.join(__dirname, \\"windows\\")),
     },
   },
 };
@@ -733,62 +541,25 @@ use_test_app!
     },
     "react-native.config.js": "const fs = require(\\"fs\\");
 const path = require(\\"path\\");
-
-const windowsProjectFile = path.join(
-  \\"node_modules\\",
-  \\".generated\\",
-  \\"windows\\",
-  \\"ReactTestApp\\",
-  \\"ReactTestApp.vcxproj\\"
-);
+const {
+  androidManifestPath,
+  iosProjectPath,
+  windowsProjectPath,
+} = require(\\"react-native-test-app\\");
 
 module.exports = {
   project: {
     android: {
       sourceDir: \\"android\\",
-      manifestPath: path.relative(
-        path.join(__dirname, \\"android\\"),
-        path.join(
-          path.dirname(require.resolve(\\"react-native-test-app/package.json\\")),
-          \\"android\\",
-          \\"app\\",
-          \\"src\\",
-          \\"main\\",
-          \\"AndroidManifest.xml\\"
-        )
-      ),
+      manifestPath: androidManifestPath(path.join(__dirname, \\"android\\")),
     },
     ios: {
-      project: (() => {
-        const {
-          packageSatisfiesVersionRange,
-        } = require(\\"react-native-test-app/scripts/configure\\");
-        if (
-          packageSatisfiesVersionRange(
-            \\"@react-native-community/cli-platform-ios\\",
-            \\"<5.0.2\\"
-          )
-        ) {
-          // Prior to @react-native-community/cli-platform-ios v5.0.0,
-          // \`project\` was only used to infer \`sourceDir\` and \`podfile\`.
-          return \\"ios/ReactTestApp-Dummy.xcodeproj\\";
-        }
-
-        // \`sourceDir\` and \`podfile\` detection was fixed in
-        // @react-native-community/cli-platform-ios v5.0.2 (see
-        // https://github.com/react-native-community/cli/pull/1444).
-        return \\"node_modules/.generated/ios/ReactTestApp.xcodeproj\\";
-      })(),
+      project: iosProjectPath(\\"ios\\"),
     },
-    windows: fs.existsSync(windowsProjectFile) && {
+    windows: fs.existsSync(\\"windows/Test.sln\\") && {
       sourceDir: \\"windows\\",
       solutionFile: \\"Test.sln\\",
-      project: {
-        projectFile: path.relative(
-          path.join(__dirname, \\"windows\\"),
-          windowsProjectFile
-        ),
-      },
+      project: windowsProjectPath(path.join(__dirname, \\"windows\\")),
     },
   },
 };
diff --git a/test/configure/reactNativeConfig.test.js b/test/configure/reactNativeConfig.test.js
index ae69156..353311f 100644
--- a/test/configure/reactNativeConfig.test.js
+++ b/test/configure/reactNativeConfig.test.js
@@ -23,34 +23,30 @@ describe("reactNativeConfig()", () => {
 
   test("returns Android specific config for a flatten structure", () => {
     const params = mockParams({ platforms: ["android"], flatten: true });
-    expect(reactNativeConfig(params)).toContain("AndroidManifest.xml");
-    expect(reactNativeConfig(params)).not.toContain(
-      "ReactTestApp-Dummy.xcodeproj"
-    );
-    expect(reactNativeConfig(params)).not.toContain("ReactTestApp.vcxproj");
+    expect(reactNativeConfig(params)).toContain("androidManifestPath");
+    expect(reactNativeConfig(params)).not.toContain("iosProjectPath");
+    expect(reactNativeConfig(params)).not.toContain("windowsProjectPath");
   });
 
   test("returns iOS specific config for a flatten structure", () => {
     const params = mockParams({ platforms: ["ios"], flatten: true });
-    expect(reactNativeConfig(params)).not.toContain("AndroidManifest.xml");
-    expect(reactNativeConfig(params)).toContain("ReactTestApp-Dummy.xcodeproj");
-    expect(reactNativeConfig(params)).not.toContain("ReactTestApp.vcxproj");
+    expect(reactNativeConfig(params)).not.toContain("androidManifestPath");
+    expect(reactNativeConfig(params)).toContain("iosProjectPath");
+    expect(reactNativeConfig(params)).not.toContain("windowsProjectPath");
   });
 
   test("returns macOS specific config for a flatten structure", () => {
     const params = mockParams({ platforms: ["macos"], flatten: true });
-    expect(reactNativeConfig(params)).not.toContain("AndroidManifest.xml");
-    expect(reactNativeConfig(params)).toContain("ReactTestApp-Dummy.xcodeproj");
-    expect(reactNativeConfig(params)).not.toContain("ReactTestApp.vcxproj");
+    expect(reactNativeConfig(params)).not.toContain("androidManifestPath");
+    expect(reactNativeConfig(params)).toContain("iosProjectPath");
+    expect(reactNativeConfig(params)).not.toContain("windowsProjectPath");
   });
 
   test("returns Windows specific config for a flatten structure", () => {
     const params = mockParams({ platforms: ["windows"], flatten: true });
-    expect(reactNativeConfig(params)).not.toContain("AndroidManifest.xml");
-    expect(reactNativeConfig(params)).not.toContain(
-      "ReactTestApp-Dummy.xcodeproj"
-    );
-    expect(reactNativeConfig(params)).toContain("ReactTestApp.vcxproj");
+    expect(reactNativeConfig(params)).not.toContain("androidManifestPath");
+    expect(reactNativeConfig(params)).not.toContain("iosProjectPath");
+    expect(reactNativeConfig(params)).toContain("windowsProjectPath");
   });
 
   test("throws when an unknown platform is specified", () => {