mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-23 20:55:47 +00:00
dbe1fa76b393228c014ecaa9072adcfe67ab6ee7
* fix(tests): wait for registry readiness in global setup instead of per-test sleep The first e2e test was flaky on CI because `start-server-and-test` only checks that the root URL (http://localhost:4000) responds before running tests, not the /r registry endpoint. The existing 2-second hardcoded sleep in the first test was unreliable on slower CI runners. Move the readiness check into the vitest globalSetup so all tests wait for the registry /r endpoint to actually be reachable before any test starts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(tests): fix race condition in global setup - poll correct URL and CLI binary Two issues caused the previous fix to fail: 1. Was polling `http://localhost:4000/r` which is a directory → always 404. Now polls `{REGISTRY_URL}/index.json`, a real static file that returns 200. 2. The v4 dev script (`pnpm --filter=shadcn build && pnpm icons:dev & next dev`) runs the shadcn CLI build in the background while next dev starts immediately. On fast CI runs start-server-and-test can detect the server as ready before the CLI binary (packages/shadcn/dist/index.js) has been built, causing the first test to fail when it tries to invoke the CLI. Now explicitly waits for the binary to exist before any test runs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(tests): warm up /init route in global setup to prevent first-test timeout The CLI's first request during `shadcn init` hits the dynamic Next.js /init route. On a cold dev server this route takes ~1.8s to compile. Combined with the rest of what init does (pnpm install, file writes), this pushes the first test over the 30s CLI timeout on CI. Subsequent tests pass because the route is already warm. Polling /init in global setup ensures the route is compiled before any test runs, making the first test's CLI invocation as fast as all subsequent ones. Also replaced the /r/index.json poll (a static file that responds immediately and doesn't reflect real route readiness) with the actual /init route poll, which also naturally verifies the registry server is up. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(tests): warm up 404 route and increase default CLI timeout Two more issues found in CI logs: 1. The CLI requests font files that don't exist (e.g. /r/styles/new-york-v4/ font-geist.json), causing Next.js to compile /_not-found/page on the first 404 response. That compilation takes ~4-5s on a cold dev server and is another hidden cost on the first test. Now triggering a 404 in global setup so the not-found page is compiled before any test runs. 2. The default CLI timeout of 30s is too tight for CI. Even with the /init and 404 routes pre-warmed, pnpm install inside the fixture takes ~25s, leaving only ~5s of headroom. Increasing the default from 30s to 60s gives a comfortable buffer without masking real hangs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
shadcn/ui
A set of beautifully designed components that you can customize, extend, and build on. Start here then make it your own. Open Source. Open Code. Use this to build your own component library.
Documentation
Visit https://ui.shadcn.com/docs to view the documentation.
Contributing
Please read the contributing guide.
License
Licensed under the MIT license.
Description
Languages
TypeScript
90.1%
MDX
6.5%
CSS
3.3%
