From ee04b5d4b39138001b84eb980e56d9abe18e4efb Mon Sep 17 00:00:00 2001 From: Menghuan1918 Date: Sun, 8 Nov 2026 00:52:16 +0800 Subject: [PATCH] test(fs): compare the session-relative tail in the missing-file message (#963) --- tests/fs-read-session-root.spec.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/fs-read-session-root.spec.ts b/tests/fs-read-session-root.spec.ts index 6e77db64..1948b6f8 100644 --- a/tests/fs-read-session-root.spec.ts +++ b/tests/fs-read-session-root.spec.ts @@ -58,7 +58,11 @@ for (const subdirectory of ['sub-en', '社媒运营']) { expect(await read(route, 'tools/a.md')).toMatchObject({ ok: true, value: { content: 'session file\n' } }) const missing = await read(route, 'root-only.md') expect(missing.ok).toBe(false) - expect(missing.error?.message).toContain(join(cwd, 'root-only.md')) + // Windows spells the same temp directory as either RUNNER~1 or + // runneradmin depending on who resolved it; the assertion is about the + // session-relative tail, not the user-profile spelling. + const message = (missing.error?.message ?? '').replace(/\\/g, '/') + expect(message).toContain(['repo', subdirectory, 'root-only.md'].join('/')) expect(readFileSync(join(repo, 'root-only.md'), 'utf8')).toBe('wrong repository-root file\n') expect(await read(route, join(cwd, 'tools', 'a.md'))).toMatchObject({ ok: true, value: { content: 'session file\n' } }) expect(await read(route, outside)).toMatchObject({ ok: true, value: { content: 'outside file\n' } })