Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: Running vitest from the C3 default SvelteKit project results in "something prevents Vite server from exiting" #7717

Open
bigmac44 opened this issue Jan 10, 2025 · 0 comments
Labels
bug Something that isn't working vitest Relating to the Workers Vitest integration

Comments

@bigmac44
Copy link

bigmac44 commented Jan 10, 2025

Which Cloudflare product(s) does this pertain to?

C3 (npm create cloudflare)

What versions are you using?

3.99.0

What operating system and version are you using?

Mac Sequoia 15.2

Please provide a link to a minimal reproduction

No response

Describe the Bug

TLDR
Vitest tests should work without timeouts / warnings when following Cloudflare's sveltekit quickstart.


Following the instructions here:
https://developers.cloudflare.com/workers/frameworks/framework-guides/svelte/

To create a minimal svelte kit app with only the vitest extra added.

When running vitest via npm run test, it exits with the warning:

close timed out after 10000ms
Tests closed successfully but something prevents Vite server from exiting

Additionally, I've tried adding the workers vitest integration and still receive the same warning.

Please provide any relevant error logs

Console logs of a minimal c3 install w/ sveltekit and vitest, showing the "something prevents Vite server from exiting" warning at the end.

erikt@m1miniether cftest % npm create cloudflare@latest my-svelte-app -- --framework=svelte --experimental
Need to install the following packages:
[email protected]
Ok to proceed? (y) y


> npx
> create-cloudflare my-svelte-app --framework=svelte --experimental


────────────────────────────────────────────────────────────────────────────────
👋 Welcome to create-cloudflare v2.36.0!
🧡 Let's get started.

🧪 Running in experimental mode

📊 Cloudflare collects telemetry about your usage of Create-Cloudflare.

Learn more at: https://github.com/cloudflare/workers-sdk/blob/main/packages/create-cloudflare/telemetry.md
────────────────────────────────────────────────────────────────────────────────

╭ Create an application with Cloudflare Step 1 of 3
│
├ In which directory do you want to create your application?
│ dir ./my-svelte-app
│
├ What would you like to start with?
│ category Framework Starter
│
├ Which development framework do you want to use?
│ framework SvelteKit
│
├ Continue with SvelteKit via `npx [email protected] create my-svelte-app`
│

Need to install the following packages:
[email protected]
Ok to proceed? (y) 

┌  Welcome to the Svelte CLI! (v0.6.10)
│
◇  Which template would you like?
│  SvelteKit minimal
│
◇  Add type checking with Typescript?
│  Yes, using Typescript syntax
│
◆  Project created
│
◇  What would you like to add to your project? (use arrow keys / space bar)
│  vitest
│
◇  Which package manager do you want to install dependencies with?
│  npm
│
◆  Successfully setup add-ons
│
◆  Successfully installed dependencies
│
◇  Project next steps ─────────────────────────────────────────────────────╮
│                                                                          │
│  1: cd my-svelte-app                                                     │
│  2: git init && git add -A && git commit -m "Initial commit" (optional)  │
│  3: npm run dev -- --open                                                │
│                                                                          │
│  To close the dev server, hit Ctrl-C                                     │
│                                                                          │
│  Stuck? Visit us at https://svelte.dev/chat                              │
│                                                                          │
├──────────────────────────────────────────────────────────────────────────╯
│
└  You're all set!


├ Copying template files
│ files copied to project directory
│
╰ Application created 

╭ Configuring your application for Cloudflare Step 2 of 3
│
├ Installing wrangler A command line tool for building Cloudflare Workers
│ installed via `npm install wrangler --save-dev`
│
├ Installing @cloudflare/workers-types
│ installed via npm
│
├ Adding latest types to `tsconfig.json`
│ added @cloudflare/workers-types/2023-07-01
│
├ Retrieving current workerd compatibility date
│ compatibility date 2025-01-09
│
├ Adding the Cloudflare Pages adapter
│ installed @sveltejs/adapter-cloudflare
│
├ Changing adapter in svelte.config.js
│
├ Updating global type definitions in app.d.ts
│
├ Adding Wrangler files to the .gitignore file
│ updated .gitignore file
│
├ Updating `package.json` scripts
│ updated `package.json`
│
├ Do you want to use git for version control?
│ no git
│
╰ Application configured 

╭ Deploy with Cloudflare Step 3 of 3
│
├ Do you want to deploy your application?
│ no deploy via `npm run deploy`
│
╰ Done 

────────────────────────────────────────────────────────────
🎉  SUCCESS  Application created successfully!

💻 Continue Developing
Change directories: cd my-svelte-app
Start dev server: npm run dev
Deploy: npm run deploy

📖 Explore Documentation
https://developers.cloudflare.com/workers

🐛 Report an Issue
https://github.com/cloudflare/workers-sdk/issues/new/choose

💬 Join our Community
https://discord.cloudflare.com
────────────────────────────────────────────────────────────


erikt@m1miniether cftest % ls
my-svelte-app
erikt@m1miniether cftest % cd my-svelte-app 
erikt@m1miniether my-svelte-app % ls
README.md		src			vite.config.ts
node_modules		static			wrangler.toml
package-lock.json	svelte.config.js
package.json		tsconfig.json
erikt@m1miniether my-svelte-app % npm run test

> [email protected] test
> npm run test:unit -- --run


> [email protected] test:unit
> vitest --run


 RUN  v2.1.8 /Users/erikt/cftest/my-svelte-app

 ✓ src/demo.spec.ts (1)
   ✓ sum test (1)
     ✓ adds 1 + 2 to equal 3

 Test Files  1 passed (1)
      Tests  1 passed (1)
   Start at  21:55:58
   Duration  331ms (transform 16ms, setup 0ms, collect 14ms, tests 2ms, environment 0ms, prepare 56ms)

close timed out after 10000ms
Tests closed successfully but something prevents Vite server from exiting
You can try to identify the cause by enabling "hanging-process" reporter. See https://vitest.dev/config/#reporters
@bigmac44 bigmac44 added the bug Something that isn't working label Jan 10, 2025
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Jan 10, 2025
@bigmac44 bigmac44 changed the title 🐛 BUG: Default SvelteKit project with vitest using create-cloudflare results in "something prevents Vite server from exiting" 🐛 BUG: Running vitest from the C3 default SvelteKit project results in "something prevents Vite server from exiting" Jan 12, 2025
@penalosa penalosa added the vitest Relating to the Workers Vitest integration label Jan 13, 2025
@penalosa penalosa moved this from Untriaged to Backlog in workers-sdk Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working vitest Relating to the Workers Vitest integration
Projects
Status: Backlog
Development

No branches or pull requests

2 participants