test(e2e): 공유 fixture build 실패 시험이 잠금을 잡은 쪽을 owner로 둔다 #46
@@ -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<void>((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);
|
||||
|
||||
Reference in New Issue
Block a user