Load a test env file into process.env, if it exists.
Without this, suites set process.env by hand in beforeAll: order-dependent, spread across
files, and easy to get wrong. A file says it once, and says it where anyone can read it.
Values already present in the environment win, so FOO=bar pnpm test and CI-provided secrets keep
overriding the file rather than being silently replaced by it. Parsing is dotenv, the same
library the CLI loads env files with, so quoting and multi-line values behave identically.
Parameters
envFile: string = DEFAULT_TEST_ENV_FILE
The file to load, relative to the project root. Defaults to .env.test.
Returns Record<string,string>
The variables the file contributed, empty when there is no such file.
Load a test env file into
process.env, if it exists.Without this, suites set
process.envby hand inbeforeAll: order-dependent, spread across files, and easy to get wrong. A file says it once, and says it where anyone can read it.Values already present in the environment win, so
FOO=bar pnpm testand CI-provided secrets keep overriding the file rather than being silently replaced by it. Parsing isdotenv, the same library the CLI loads env files with, so quoting and multi-line values behave identically.