Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion ts/packages/shell/test/testHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,30 @@ export function getAppPath(): string {
return appPath;
}

/**
* Resolve the config file to pass via --env.
*
* After PR #2342 the canonical key-config format is `config.local.yaml`
* (written by `tools/scripts/getKeys.mjs`), and the legacy `.env` is only
* produced when `--dotenv` is explicitly passed to getKeys. Prefer the YAML
* file when present so smoke tests work in both CI (YAML-only) and local
* developer environments that may still have a `.env`.
*/
function resolveTestConfigPath(appPath: string): string {
const yamlPath = path.resolve(appPath, "../../config.local.yaml");
if (fs.existsSync(yamlPath)) {
return yamlPath;
}
const dotenvPath = path.resolve(appPath, "../../.env");
if (fs.existsSync(dotenvPath)) {
return dotenvPath;
}
throw new Error(
`No test config file found. Expected either ${yamlPath} or ${dotenvPath}. ` +
`Run 'node tools/scripts/getKeys.mjs --vault <name> --commit' to generate one.`,
);
}

/**
* Get electron launch arguments
* @returns The arguments to pass to the electron application
Expand All @@ -204,7 +228,7 @@ export function getLaunchArgs(testGreetings: boolean): string[] {
appPath,
"--test",
"--env",
path.resolve(appPath, "../../.env"),
resolveTestConfigPath(appPath),
];
if (os.platform() === "linux") {
// Ubuntu 24.04+ needs --no-sandbox, see https://github.com/electron/electron/issues/18265
Expand Down
Loading