From 52e1a471a27adc6c632461b70ef7ac3c73861497 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Fri, 13 Nov 2026 15:05:44 +0900 Subject: [PATCH] =?UTF-8?q?test(e2e):=20=EA=B3=B5=EC=9C=A0=20fixture=20bui?= =?UTF-8?q?ld=20=EC=8B=A4=ED=8C=A8=20=EC=8B=9C=ED=97=98=EC=9D=B4=20?= =?UTF-8?q?=EC=9E=A0=EA=B8=88=EC=9D=84=20=EC=9E=A1=EC=9D=80=20=EC=AA=BD?= =?UTF-8?q?=EC=9D=84=20owner=EB=A1=9C=20=EB=91=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: `tests/unit/shared-fixture-builds.test.ts`의 「fails the waiting callers with the builder's failure」가 runner run 235(PR #44, FE-GATE-020 scaffold 사본의 test:coverage)에서 실패했다. 시험은 먼저 부른 호출이 잠금을 잡는다고 가정했다. 그러나 잠금은 key 폴더의 `mkdir`이고, 먼저 끝난 `mkdir`이 주인이 된다. 두 번째 호출(waiter)이 먼저 잡아 빌드했고, 먼저 부른 owner는 기다리는 쪽이 되어 그 성공(`{}`)을 받았다. 구현은 맞고 시험의 가정이 틀렸다(r9-fe 넘김). 고친 것: owner의 builder가 시작될 때(곧 owner가 잠금을 잡았을 때) 알리고, 그 뒤에 waiter를 부른다. 버린 대안: 두 호출에 같은 실패 builder를 주고 결과를 순서 없이 비교하기. 「기다리는 쪽이 빌드한 쪽의 실패를 받는다」를 누가 어느 쪽인지 모른 채 보게 된다. 검증(desktop): 첫 `mkdir`만 30ms 늦추는 일회용 시험에서 옛 시험은 runner와 같은 「promise resolved instead of rejecting」으로 실패하고(RED), 새 시험은 통과했다. 실제 파일 3회 6개 통과, eslint rc=0. --- tests/unit/shared-fixture-builds.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/unit/shared-fixture-builds.test.ts b/tests/unit/shared-fixture-builds.test.ts index 210071d1..3071fb5a 100644 --- a/tests/unit/shared-fixture-builds.test.ts +++ b/tests/unit/shared-fixture-builds.test.ts @@ -57,17 +57,27 @@ describe("one fixture build per e2e run", () => { ).rejects.toThrow(/fixture-b was built from another definition/u); }); + // The key's folder is the lock, and the call whose mkdir finishes first owns + // it, not the one made first: runner run 235 let the second call build and + // the first wait for its success. The waiter starts once the owner's + // builder runs, that is once the owner holds the lock. it("fails the waiting callers with the builder's failure", async () => { const environment = await sharedEnvironment(); + let building!: () => void; + const ownerBuilds = new Promise((resolve) => { + building = resolve; + }); const owner = sharedFixtureBuild( "fixture-c", "same", async () => { + building(); await new Promise((resolve) => setTimeout(resolve, 50)); throw new Error("vite build exited 1"); }, environment, ); + await ownerBuilds; const waiter = sharedFixtureBuild("fixture-c", "same", async () => ({}), environment); await expect(owner).rejects.toThrow(/vite build exited 1/u); -- 2.54.0