Closed jacoberdman2147 closed 4 days ago
Built without sensitive environment variables
Name | Link |
---|---|
Latest commit | 9f7c89dae6447ec57448256ea89b487fafc32428 |
Latest deploy log | https://app.netlify.com/sites/vitest-dev/deploys/67353b5cf6dadc0008d19280 |
Deploy Preview | https://deploy-preview-6902--vitest-dev.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
So I spent a while looking into the test failures and I'm not really sure what to do. The specific web.test.ts
and ssr.test.ts
work fine before my last commit to remove the resolver plugin's handling of cacheDir
, but without that commit we run into issues with cache.test.ts
in the default case with optimizer enabled. The issue (with all commits) seems to be that the config for the ViteNodeServer
isn't using the resolved cacheDir
that we get from the resolveConfig
method in the Vitest
class, but I'm not sure if it should be or not. I don't completely understand how it all works but it seems like the cache for resolved modules and stuff being based around .vite
by default could maybe make sense, but it may also make sense to pass down our resolved cacheDir
, I'm not sure.
Thanks for investigating this. I took a look and indeed the current state is quite complicated. But my intuition is that we shouldn't need to change createVitest
. We need to figure out how to deal with cacheDir
overwritten here for optimize deps:
and we again deriving cache.dir
from it
Note that Vite's cacheDir
for optimize deps and Vitest's cache.dir
for ResultCache
are two completely different concepts. Probably there's some limits what we can do, but let me try something in https://github.com/vitest-dev/vitest/pull/6910/.
If we have to choose one, probably test/optimize-deps
should pass and cache.test.ts
is the one broken.
Yeah it looks like your fix better addresses the cacheDir
behavior, thanks for looking into that. As far as the tests go though, that web optimizer test for cache.test.ts
wasn't actually getting that optimizer option through to the plugin like it should be, and that's why I had the change in createVitest
. Without it, those tests aren't actually testing the behavior that they say they are so it seems like we might still want to keep that part? That is, unless the change you made here https://github.com/vitest-dev/vitest/pull/6910/files#r1843197601 addresses that piece, in which case, I'll close this PR.
As far as the tests go though, that web optimizer test for
cache.test.ts
wasn't actually getting that optimizer option through to the plugin like it should be, and that's why I had the change increateVitest
. Without it, those tests aren't actually testing the behavior that they say they are so it seems like we might still want to keep that part? That is, unless the change you made here https://github.com/vitest-dev/vitest/pull/6910/files#r1843197601 addresses that piece, in which case, I'll close this PR.
Your observation is right. Passing test: options
in createVitest
does make sense to me, but I wasn't entirely sure if it has any downside, so I did a smaller change for now. Maybe we'll need to revisit that in the future, but I think we can close this.
Thanks again for the contribution :pray:
Description
Fixes #6733
So initially it just seemed like the
viteConfig.cacheDir
set within optimizer should have been prioritizing the one defined in the config but there were other issues with the waycacheDir
was being handled within theresolveOptimizerConfig
function so I decided to remove thecacheDir
logic entirely since it seemed to be unnecessary.With this, I also fixed an issue where the
runVitest
function used within some of the tests wasn't properly passing through the options that were given to it. This uncovered the failures withincache.test.ts
that should have been happening all along.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.