-
-
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
fix: prevent vitest from hanging when using cloudflare/cloudflare-workers #12306
Conversation
🦋 Changeset detectedLatest commit: 0faac07 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
plugins: [sveltekit()], | ||
test: { | ||
include: ['src/**/*.{test,spec}.{js,ts}'], | ||
// https://github.com/sveltejs/kit/issues/12305 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment is confusing. it seems to be saying that the teardownTimeout
option is added to workaround issue #12305. however, that issue would be closed by this PR. can you add some text to go with the link and give some context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benmccann Actually this is not necessary at all. It has the default value of 10000
or 10 seconds. I didn't want to make the test take 10 seconds longer, which happens when this fix goes broken and the test case fails. Do you think I can remove this entirely, or should I write in detail why I specified smaller value than the default in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the former approach, i.e. removing the timeout field.
@benmccann Hi, here's a friendly reminder about this PR. |
Thank you for the PR - we went with #12830 instead, so closing this one. |
Adapter.emulate
is a property used foradapter-cloudflare
andadapter-cloudflare-workers
. Because it is invoked earlier than needed,vitest
runs hang as theMiniflare
instance is not released. This PR makesAdapter.emulator
called right before its return value is needed.prerender
code is changed too, but it seems thatadapter-cloudflare/cloudflare-workers
don't allow pages to be prerendered. Return type ofdev
was changed because of ESLint error banningasync
functions without anyawait
s. It still returns an allowed type.To make sure
dev
/preview
server works with no problems, I've visually checked the rendered output ofpackages/kit/test/apps/cloudflare
by runningdev
andbuild
/preview
. Also I've added a Playwright test to make sure the page is properly rendered and able to connect to Cloudflare KV namespaces.Fixes #12305.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.Edits