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

Vitest browser mode breaks ensureFileWatched #7356

Open
6 tasks done
mrginglymus opened this issue Jan 24, 2025 · 1 comment
Open
6 tasks done

Vitest browser mode breaks ensureFileWatched #7356

mrginglymus opened this issue Jan 24, 2025 · 1 comment

Comments

@mrginglymus
Copy link
Contributor

Describe the bug

Files in vitest that would normally be watched by vitest here:

https://github.com/vitejs/vite/blob/30194fa1e41dda6470aa20f2bb34655c4bfd9cd1/packages/vite/src/node/server/transformRequest.ts#L286-L292

are not watched when running in browser mode, as environment.pluginContainer.watcher is a no-op watcher. This will apply in fact to any attempt to watch a file via the PluginContainer.

Reproduction

https://github.com/mrginglymus/vitest-pnp

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (24) x64 Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz
    Memory: 20.97 GB / 63.80 GB
  Binaries:
    Node: 22.13.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 4.5.2 - C:\Program Files\nodejs\yarn.CMD
    npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (131.0.2903.146)
    Internet Explorer: 11.0.19041.4355

Used Package Manager

yarn

Validations

@mrginglymus
Copy link
Contributor Author

A dirty workaround is to add:

vite.pluginContainer.environments.client._pluginContainer.watcher = project.vite.watcher;

here:

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

No branches or pull requests

1 participant