




















@@ -76,6 +76,17 @@ function expectWrapperToContainPathSuffix(wrapper: string, pathSuffix: string[])
7676}
7777}
787879+async function expectPathMissing(targetPath: string): Promise<void> {
80+let error: unknown;
81+try {
82+await fs.access(targetPath);
83+} catch (caught) {
84+error = caught;
85+}
86+expect(error).toBeInstanceOf(Error);
87+expect((error as NodeJS.ErrnoException).code).toBe("ENOENT");
88+}
89+7990afterEach(async () => {
8091vi.restoreAllMocks();
8192restoreEnv("CODEX_HOME");
@@ -121,9 +132,7 @@ describe("prepareAcpxCodexAuthConfig", () => {
121132const wrapper = await fs.readFile(generated.wrapperPath, "utf8");
122133expect(wrapper).toContain(JSON.stringify(installedBinPath));
123134expect(wrapper).toContain("defaultArgs = [installedBinPath]");
124-await expect(
125-fs.access(path.join(agentDir, "acp-auth", "codex", "auth.json")),
126-).rejects.toMatchObject({ code: "ENOENT" });
135+await expectPathMissing(path.join(agentDir, "acp-auth", "codex", "auth.json"));
127136});
128137129138it("keeps generated wrappers usable when chmod is rejected by the state filesystem", async () => {
@@ -373,12 +382,8 @@ describe("prepareAcpxCodexAuthConfig", () => {
373382const wrapper = await fs.readFile(generated.wrapperPath, "utf8");
374383expect(wrapper).toContain("CODEX_HOME: codexHome");
375384expect(wrapper).not.toContain(sourceCodexHome);
376-await expect(
377-fs.access(path.join(agentDir, "acp-auth", "codex-source", "auth.json")),
378-).rejects.toMatchObject({ code: "ENOENT" });
379-await expect(
380-fs.access(path.join(agentDir, "acp-auth", "codex", "auth.json")),
381-).rejects.toMatchObject({ code: "ENOENT" });
385+await expectPathMissing(path.join(agentDir, "acp-auth", "codex-source", "auth.json"));
386+await expectPathMissing(path.join(agentDir, "acp-auth", "codex", "auth.json"));
382387});
383388384389it("copies only trusted Codex project declarations into the isolated Codex home", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。