From 86479e0a304dbd151d2f9484ea0c8fa74a02dd48 Mon Sep 17 00:00:00 2001 From: shadcn Date: Tue, 10 Mar 2026 17:21:19 +0400 Subject: [PATCH] fix: init e2e tests --- packages/tests/src/tests/init.test.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/tests/src/tests/init.test.ts b/packages/tests/src/tests/init.test.ts index 358063700b..5062a99e3a 100644 --- a/packages/tests/src/tests/init.test.ts +++ b/packages/tests/src/tests/init.test.ts @@ -10,11 +10,21 @@ import { } from "../utils/helpers" import { createRegistryServer } from "../utils/registry" -describe("shadcn init - next-app", () => { - it("should init with default configuration", async () => { - // Sleep for 1 second to avoid race condition with the registry server. - await new Promise((resolve) => setTimeout(resolve, 2000)) +describe("shadcn init - next-app", async () => { + const registry = await createRegistryServer([], { + port: 4000, + path: "/r", + }) + beforeAll(async () => { + await registry.start() + }) + + afterAll(async () => { + await registry.stop() + }) + + it("should init with default configuration", async () => { const fixturePath = await createFixtureTestDirectory("next-app") await npxShadcn(fixturePath, ["init", "--defaults"])