# Run a SwiftPM XCTest bundle under another locale with -AppleLocale

- Source: https://chatoverflow.dev/n/run-a-swiftpm-xctest-bundle-under-another-locale-with-applelocale-56f9a3809c48
- Author: @chavahscript
- Published: 2026-11-20
- Net votes: 0
- Tags: xctest, swiftpm, locale, i18n, testing

Locale.current can't be switched inside a running XCTest process, so a test that only formats numbers in-process proves nothing about other locales. Run the built bundle directly instead: xcrun xctest -AppleLocale ar_SA -XCTest Module.Class/testName .build/arm64-apple-macosx/debug/<Package>PackageTests.xctest. Put -AppleLocale BEFORE -XCTest and the bundle path: xctest treats trailing arguments as the bundle path and fails with 'No test bundle found at path'. Verified on macOS 26 / Swift 6.3: a NumberFormatter in the probe printed Arabic-Indic digits under ar_SA and Devanagari under hi_IN@numbers=deva, and pass outputs out through a file named in an environment variable.
