Skip to content

Commit 43654c2

Browse files
committed
fix(tests): avoid keychain dependency in linear alias test
1 parent 6f4f9fb commit 43654c2

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

tests/linear-command-alias.test.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ let tempGlobalConfigPath: string | null = null;
88
let previousGlobalConfigPath: string | undefined;
99
let previousHome: string | undefined;
1010
let previousLogger: string | undefined;
11+
let previousSecretsKey: string | undefined;
1112
let previousSetupSyncMode: string | undefined;
1213

1314
beforeEach(async () => {
@@ -16,12 +17,30 @@ beforeEach(async () => {
1617
previousGlobalConfigPath = process.env.HACK_GLOBAL_CONFIG_PATH;
1718
previousHome = process.env.HOME;
1819
previousLogger = process.env.HACK_LOGGER;
20+
previousSecretsKey = process.env.HACK_SECRETS_FILE_KEY;
1921
previousSetupSyncMode = process.env.HACK_SETUP_SYNC_MODE;
2022
process.env.HACK_GLOBAL_CONFIG_PATH = tempGlobalConfigPath;
2123
process.env.HOME = tempDir;
2224
process.env.HACK_LOGGER = "console";
25+
process.env.HACK_SECRETS_FILE_KEY = "test-linear-alias-key";
2326
process.env.HACK_SETUP_SYNC_MODE = "off";
24-
await writeFile(tempGlobalConfigPath, "{}\n");
27+
await writeFile(
28+
tempGlobalConfigPath,
29+
`${JSON.stringify(
30+
{
31+
controlPlane: {
32+
secrets: {
33+
backend: "encrypted_file",
34+
encryptedFile: {
35+
path: resolve(tempDir, "secrets.enc.json"),
36+
},
37+
},
38+
},
39+
},
40+
null,
41+
2
42+
)}\n`
43+
);
2544
});
2645

2746
afterEach(async () => {
@@ -45,6 +64,11 @@ afterEach(async () => {
4564
} else {
4665
process.env.HACK_LOGGER = previousLogger;
4766
}
67+
if (previousSecretsKey === undefined) {
68+
process.env.HACK_SECRETS_FILE_KEY = undefined;
69+
} else {
70+
process.env.HACK_SECRETS_FILE_KEY = previousSecretsKey;
71+
}
4872
if (previousSetupSyncMode === undefined) {
4973
process.env.HACK_SETUP_SYNC_MODE = undefined;
5074
} else {
@@ -69,6 +93,7 @@ test("hack linear alias forwards extension options like --json", async () => {
6993
FORCE_COLOR: "0",
7094
HACK_GLOBAL_CONFIG_PATH: tempGlobalConfigPath ?? "",
7195
HACK_LOGGER: "console",
96+
HACK_SECRETS_FILE_KEY: "test-linear-alias-key",
7297
HACK_SETUP_SYNC_MODE: "off",
7398
HOME: tempDir ?? process.env.HOME ?? "",
7499
NO_COLOR: "1",

0 commit comments

Comments
 (0)