- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 220
Open
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomerspr welcome
Description
Describe the bug
When I have a local library added to auto-import, and there is a function in the library, and one of the function's parameters is named as it, auto-import will import vitest's it, which will cause serious errors.
This code:
export default {
  func: (it: unknown) => {
    console.log(it)
  },
}Will be transfered to this by auto import:
import { it } from "/node_modules/.vite/deps/vitest.js?v=0ceb812e";
export default {
  func: (it) => {
    console.log(it);
  }
};Which results this error:
Error: Vitest failed to access its internal state.
One of the following is possible:
- "vitest" is imported directly without running "vitest" command
- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)
- "vitest" is imported inside Vite / Vitest config file
- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues
Reproduction
See above
System Info
OmitUsed Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- 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, please open a GitHub Discussion instead.
- The provided reproduction is a minimal reproducible of the bug.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomerspr welcome