Override $LANG when running Jest tests
Created by: LawnGnome
This is an alternative approach to fixing the issue in #11037, as suggested by @felixfbecker: instead of modifying the <CampaignBurndownChart />
component to allow overridding the locale, we instead override $LANG
unconditionally when running tests in Jest to ensure that we don't have snapshot test breakage due to different locales.
This ended up being uglier than I would have liked (specifically, it's a side effect in the Jest config module): we have code in shared/dev/jestGlobalState.js
to override $TZ
for similar reasons, but $LANG
is read very early, and only once per process, after which it's memoised. Having the process.env.LANG
set in jestGlobalState.js
worked when the tests were being run in the default child process pool mode, but did not work when the tests were being run in-band, and I decided I preferred the ugly side effect to modal non-determinism.