Skip to content

eperimentalVmThreads and vi.useFakeTimers() with jsdom environment #3863

@cexbrayat

Description

@cexbrayat

Describe the bug

Using vi.useFakeTimers() throws when the test is run with --experimental-vm-threads in jsdom environment in v0.34.1

TypeError: Cannot set properties of undefined (setting 'hadOwnProperty')
 ❯ test/basic.test.ts:6:6
      4|
      5| test('Math.sqrt()', () => {
      6|   vi.useFakeTimers()

Reproduction

https://github.com/cexbrayat/vitest-repro-experimental-vm-threads

yarn
yarn test

The repro is the basic test calling vi.useFaketimer() and environment: "jsdom".

System Info

System:
    OS: macOS 13.4.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 34.05 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.0 - ~/.volta/tools/image/node/18.16.0/bin/node
    Yarn: 1.22.17 - ~/.volta/tools/image/yarn/1.22.17/bin/yarn
    npm: 9.7.1 - ~/.volta/tools/image/npm/9.7.1/bin/npm
    pnpm: 8.6.9 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 115.0.5790.114
    Safari: 16.5.2
  npmPackages:
    vite: 4.4.8 => 4.4.8
    vitest: 0.34.1 => 0.34.1

Used Package Manager

yarn

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions