Introduce `vi.hoisted` to run code before imports and `vi.mock` · Issue #3228 · vitest-dev/vitest

Clear and concise description of the problem All imports in ESM are hoisted to the top of the file, so any code that is defined before that run after imports and all its side effects. Vitest also h...