Files
hyperframes/packages/cli/src/auth/paths.test.ts
T
Miguel Ángel 216395e98e fix(cli): every settings file follows HYPERFRAMES_CONFIG_DIR (#7229)
* fix(cli): every settings file follows HYPERFRAMES_CONFIG_DIR

* fix(cli): the media-use skill copy reads its config from HYPERFRAMES_CONFIG_DIR too

* test(cli): expect the config folder as a normalized path on every platform

* chore(skills): refresh the media-use manifest hash

* fix(cli): a moved settings folder starts from ~/.hyperframes, keeping an opt-out

* fix(cli): drop the updater's unused path import

* style(cli): keep the settings-seed comment under 120 characters
2026-11-05 11:34:36 +00:00

41 lines
1.4 KiB
TypeScript

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { homedir } from "node:os";
import { join } from "node:path";
import { CREDENTIAL_FILENAME, configDir, credentialPath } from "./paths.js";
describe("auth/paths", () => {
const original = process.env["HYPERFRAMES_CONFIG_DIR"];
beforeEach(() => {
delete process.env["HYPERFRAMES_CONFIG_DIR"];
});
afterEach(() => {
vi.unstubAllEnvs();
if (original !== undefined) process.env["HYPERFRAMES_CONFIG_DIR"] = original;
else delete process.env["HYPERFRAMES_CONFIG_DIR"];
});
it("defaults to ~/.hyperframes", () => {
expect(configDir()).toBe(join(homedir(), ".hyperframes"));
});
it("honors HYPERFRAMES_CONFIG_DIR override", () => {
process.env["HYPERFRAMES_CONFIG_DIR"] = "/tmp/some-test-dir";
expect(configDir()).toBe(join("/tmp/some-test-dir"));
expect(credentialPath()).toBe(join("/tmp/some-test-dir", CREDENTIAL_FILENAME));
});
it("treats empty HYPERFRAMES_CONFIG_DIR as unset", () => {
process.env["HYPERFRAMES_CONFIG_DIR"] = "";
expect(configDir()).toBe(join(homedir(), ".hyperframes"));
});
it("ignores the HeyGen CLI directory and isolates the dev environment", () => {
vi.stubEnv("HEYGEN_CONFIG_DIR", "/tmp/heygen-other-account");
expect(configDir()).toBe(join(homedir(), ".hyperframes"));
vi.stubEnv("HYPERFRAMES_ENV", "dev");
expect(configDir()).toBe(join(homedir(), ".hyperframes", "dev"));
});
});