-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
disable illegal import detection when running tests #8365
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
Conversation
🦋 Changeset detectedLatest commit: e9e1285 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 |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
I think we should list this in the docs somewhere. Unless this |
|
added some docs |
This is needed to make tests pass see sveltejs/kit#8365
This is needed to make tests pass see sveltejs/kit#8365
This is needed to make tests pass see sveltejs/kit#8365
This is needed to make tests pass see sveltejs/kit#8365
This is needed to make tests pass see sveltejs/kit#8365
This is needed to make tests pass see sveltejs/kit#8365
This is a naive but effective fix for #8180. When running Vitest, both
process.env.VITESTandprocess.env.TESTaretrue, meaning we can simply ignore illegal imports during unit testing.I opted for
TESToverVITESTbecause it will then work with any unit testing framework that works with Vite, as long as they adhere to this convention.I think it's totally fine to skip detection during tests, since it'd be vanishingly rare that something was explicitly testing for that behaviour. The error will show up soon enough in dev, and the build will fail.
One gotcha is that if you do
TEST=true npm run devit will disable illegal import detection during dev (not build), which I think is probably a fine trade-off.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. All changesets should bepatchuntil SvelteKit 1.0