You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
describe('suite name',()=>{it('validates that async import works as expected.',async()=>{consthello0=awaitimport(urlHelloJs.href);expect(hello0['sayHello']).toBeTypeOf('function');});it('validates that async import with hash change will reload.',async()=>{consthello0=awaitimport(urlHelloJs.href);consturl1=newURL(urlHelloJs);url1.hash='bustCache=1';consthello1=awaitimport(url1.href);expect(hello1['sayHello']).toBeTypeOf('function');expect(hello1).not.toBe(hello0);});it('validates that async import with query change will reload.',async()=>{consthello0=awaitimport(urlHelloJs.href);consturl1=newURL(urlHelloJs);url1.searchParams.set('bustCache','1');consthello1=awaitimport(url1.href);expect(hello1['sayHello']).toBeTypeOf('function');expect(hello1).not.toBe(hello0);});});
System Info
Note: it breaks on Linux and Windows as well.
System:
OS: macOS 15.2
CPU: (12) arm64 Apple M3 Pro
Memory: 182.05 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.18.1 - ~/.nvm/versions/node/v20.18.1/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v20.18.1/bin/npm
pnpm: 9.15.0 - ~/.nvm/versions/node/v20.18.1/bin/pnpm
Browsers:
Chrome: 132.0.6834.110
Edge: 132.0.2957.127
Safari: 18.2
npmPackages:
@vitest/coverage-istanbul: ^3.0.4 => 3.0.4
vite: ^6.0.11 => 6.0.11
vitest: ^3.0.4 => 3.0.4
Side note: Vite doesn't seem to have a same issue even though they also use fileURLToPath internally. This is probably because the module cache key is based on id/url before fileURLToPath normalization. (Oh wait, they do have a same issue https://stackblitz.com/edit/vitest-dev-vitest-fchdscfz?file=repro.js but I imagine the issue is independent from Vitest.)
Describe the bug
V3 seems to be changing how dynamic imports work.
Imports in the following style seem to be incorrectly cached.
Note: This works correctly in V2.
Might be related to: #7269, #7266, but it doesn't seem to be fixed in v3.0.4.
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-1rbfzzpd?file=test%2Fsuite.test.ts
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: