-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
vitest
hangs when using adapter-cloudflare
#12305
Comments
Adding statement |
I've found a better, potential fix: moving this line into the |
I know this is a ridiculous fix but
|
I have also hit the issue. It renders unit testing unusable with no obvious workaround except for downgrading to 4.1.0 which is getting a fair way behind the latest. |
These are the logs when it hangs (after upgrading everything to the latest). ❯ npm run test -- --run
> [email protected] test
> vitest --run
RUN v2.1.3 /home/chewteeming/github/sveltekit-vitest-repro
✓ src/index.test.js (1)
✓ sum test (1)
✓ adds 1 + 2 to equal 3
Test Files 1 passed (1)
Tests 1 passed (1)
Start at 13:44:29
Duration 239ms (transform 11ms, setup 0ms, collect 9ms, tests 2ms, environment 0ms, prepare 61ms)
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/#reporter |
My current temporary solution is to switch to // svelte.config.js
import { default as auto} from '@sveltejs/adapter-auto';
import { default as cf } from '@sveltejs/adapter-cloudflare';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
const config = {
preprocess: vitePreprocess(),
kit: {
adapter: process.env.VITEST ? auto() : cf()
}
};
export default config; |
Thanks @knicholson32. That works, however it does require a different approach to passing env vars. e.g. using .env.local with the .dev.vars subsets you need in tests, loading env from vite.config.ts, prepending with VITE_ and checking for VITE_ prefix in the code. |
Describe the bug
Everything seems okay when using
adapter-auto
. Howevervitest
hangs Withadapter-cloudflare
. I saw this issue and triedpool: 'forks'
but it didn't fix the problem.Reproduction
https://github.com/wooseopkim/sveltekit-vitest-repro
This repository contains source code generated with
npm create svelte@latest
just with the additional dependency of@sveltejs/adapter-cloudflare
. Runnpm run test -- --run
to see the problem.Logs
Below is the output with
hanging-reporters
invite.config.js
.System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: