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

Solid plugin config function causes issues with Vitest 3.0 #170

Open
pedro00dk opened this issue Jan 17, 2025 · 2 comments
Open

Solid plugin config function causes issues with Vitest 3.0 #170

pedro00dk opened this issue Jan 17, 2025 · 2 comments

Comments

@pedro00dk
Copy link

Hi!

I had an issue when trying to use solid-js with vitest and stumbled on an issue. Not to repeat myself, please check the vitest issue vitest-dev/vitest#7284 .

According to one of vitest authors, the tl;dr is:

Returning an object from a config hooks will merge that object with an existing config, this is how this hook works: https://vite.dev/guide/api-plugin.html#config
This is a bug in solidjs plugin, do not return already resolved object. Either modify the config or return a partial object that will be merged with an existing config.**

Related: #101
It seems there where attempts to fix a similar issue before.

@pedro00dk pedro00dk changed the title Solid plugin config editing causes issues with Vitest 3.0 Solid plugin config function causes issues with Vitest 3.0 Jan 17, 2025
@simonihmig
Copy link

I can confirm this issue, just ran ino it myself.

Seems the config hook is returning the full test object here that it received as input, causing the duplication in the browser.instances array after the deep merge.

simonihmig added a commit to simonihmig/responsive-image that referenced this issue Jan 19, 2025
simonihmig added a commit to simonihmig/responsive-image that referenced this issue Jan 19, 2025
@simonihmig
Copy link

I got around it for now by patching locally to not return the test object. Ok-ish as a temporary workaround, but I don't think this fix is PR-worthy, as the plugin should really decide how it wants to use the config hook: either mutate or return the config to be merged, but not both (as suggested on the vitest issue linked above).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants