-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
From what I tried so far, the watchExclude for code in node_modules option doesn't work when:
- the environment is
node. - the environment is
jsdomand- the first time you edit the main file of a node module, or
- every time you edit a non-main file of a node module
More discussion info: #4772 (reply in thread)
Reproduction
https://github.com/Jinjiang/reproductions/tree/vitest-watch-node_modules-20231220
pnpm install
# you can switch environment between 'node' (default value) and 'jsdom'
pnpm test
# in 'node' environment:
#
# modify any code in node_modules
# - the test is not re-run
# in 'jsdom' environment:
#
# modify code in node_modules/foo-cjs/index.js or node_modules/foo-esm/index.js
# - when you first time modify it, the test is not re-run
# - when you further modify it, the test is re-run
#
# modify code in node_modules/foo-cjs/foo.js or node_modules/foo-esm/foo.js
# - the test is not re-run
The expected behavior is that the test is always re-run when any code in node_modules/foo-cjs and node_modules/foo-esm is modified whatever the environment is.
System Info
System:
OS: macOS 14.3
CPU: (8) arm64 Apple M1
Memory: 88.61 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.1.0 - ~/.asdf/installs/nodejs/20.1.0/bin/node
Yarn: 1.22.19 - ~/.asdf/shims/yarn
npm: 9.6.4 - ~/.asdf/plugins/nodejs/shims/npm
pnpm: 8.12.0 - ~/Library/pnpm/pnpm
Browsers:
Safari: 17.3
npmPackages:
vite: ^5.0.10 => 5.0.10
vitest: ^1.0.4 => 1.0.4Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)