fix(test): address review follow-ups for config dir layering
This commit is contained in:
@@ -56,6 +56,7 @@ const NO_FRONTMATTER_AGENT = `Just a prompt with no frontmatter.`;
|
|||||||
describe("claude-code-agent-loader", () => {
|
describe("claude-code-agent-loader", () => {
|
||||||
const dirs: string[] = [];
|
const dirs: string[] = [];
|
||||||
const originalEnv = {
|
const originalEnv = {
|
||||||
|
CLAUDE_CONFIG_DIR: process.env.CLAUDE_CONFIG_DIR,
|
||||||
OPENCODE_CONFIG_DIR: process.env.OPENCODE_CONFIG_DIR,
|
OPENCODE_CONFIG_DIR: process.env.OPENCODE_CONFIG_DIR,
|
||||||
XDG_CONFIG_HOME: process.env.XDG_CONFIG_HOME,
|
XDG_CONFIG_HOME: process.env.XDG_CONFIG_HOME,
|
||||||
}
|
}
|
||||||
@@ -65,6 +66,11 @@ describe("claude-code-agent-loader", () => {
|
|||||||
rmSync(dir, { recursive: true, force: true });
|
rmSync(dir, { recursive: true, force: true });
|
||||||
}
|
}
|
||||||
dirs.length = 0;
|
dirs.length = 0;
|
||||||
|
if (originalEnv.CLAUDE_CONFIG_DIR === undefined) {
|
||||||
|
delete process.env.CLAUDE_CONFIG_DIR
|
||||||
|
} else {
|
||||||
|
process.env.CLAUDE_CONFIG_DIR = originalEnv.CLAUDE_CONFIG_DIR
|
||||||
|
}
|
||||||
if (originalEnv.OPENCODE_CONFIG_DIR === undefined) {
|
if (originalEnv.OPENCODE_CONFIG_DIR === undefined) {
|
||||||
delete process.env.OPENCODE_CONFIG_DIR
|
delete process.env.OPENCODE_CONFIG_DIR
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -78,9 +78,11 @@ export function getOpenCodeConfigDirs(options: OpenCodeConfigDirOptions): string
|
|||||||
return [getOpenCodeConfigDir(options)]
|
return [getOpenCodeConfigDir(options)]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const customConfigDir = getCliCustomConfigDir()
|
||||||
|
|
||||||
return Array.from(
|
return Array.from(
|
||||||
new Set([
|
new Set([
|
||||||
...(getCliCustomConfigDir() ? [getCliCustomConfigDir()!] : []),
|
...(customConfigDir ? [customConfigDir] : []),
|
||||||
getCliDefaultConfigDir(),
|
getCliDefaultConfigDir(),
|
||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user