Summary
The setNewArch command (src/extension/commands/setNewArch.ts) modifies ios/Podfile and android/gradle.properties to toggle React Native New Architecture. This logic has no unit tests, leaving the file-parsing and write-back paths unverified.
Why this is useful
Similar commands with non-trivial file manipulation — enableHermes, installExpoGoApplication, prebuild, configEASBuild — all have unit tests. Adding tests for setNewArch closes a consistency gap and guards against regressions when the New Architecture flags or file formats change.
Suggested scope
- Add
test/extension/commands/setNewArch.test.ts following the proxyquire/sinon pattern used by adjacent tests
- Cover: Android path (
gradle.properties has existing newArchEnabled entry vs. missing entry), iOS path (Podfile includes the disable line vs. does not), and user-cancellation (QuickPick returns undefined)
- Fix the typo in
InternalErrorCode: FaiedToSetNewArch → FailedToSetNewArch (src/common/error/internalErrorCode.ts:40)
Evidence
src/extension/commands/setNewArch.ts — 87 lines, no corresponding test file under test/extension/commands/
src/common/error/internalErrorCode.ts:40 — FaiedToSetNewArch = 135 (typo)
- Comparable test:
test/extension/commands/enableHermes.test.ts uses temp-dir + proxyquire pattern that applies directly here
Validation
npm test passes with the new test file included
- Both Android and iOS branches exercised in isolation without touching real project files
Summary
The
setNewArchcommand (src/extension/commands/setNewArch.ts) modifiesios/Podfileandandroid/gradle.propertiesto toggle React Native New Architecture. This logic has no unit tests, leaving the file-parsing and write-back paths unverified.Why this is useful
Similar commands with non-trivial file manipulation —
enableHermes,installExpoGoApplication,prebuild,configEASBuild— all have unit tests. Adding tests forsetNewArchcloses a consistency gap and guards against regressions when the New Architecture flags or file formats change.Suggested scope
test/extension/commands/setNewArch.test.tsfollowing theproxyquire/sinonpattern used by adjacent testsgradle.propertieshas existingnewArchEnabledentry vs. missing entry), iOS path (Podfile includes the disable line vs. does not), and user-cancellation (QuickPick returnsundefined)InternalErrorCode:FaiedToSetNewArch→FailedToSetNewArch(src/common/error/internalErrorCode.ts:40)Evidence
src/extension/commands/setNewArch.ts— 87 lines, no corresponding test file undertest/extension/commands/src/common/error/internalErrorCode.ts:40—FaiedToSetNewArch = 135(typo)test/extension/commands/enableHermes.test.tsuses temp-dir + proxyquire pattern that applies directly hereValidation
npm testpasses with the new test file included