vitest icon indicating copy to clipboard operation
vitest copied to clipboard

`Intl.RelativeTimeFormat` and `Intl.ListFormat` can't be spied upon

Open amannn opened this issue 7 months ago • 4 comments

Describe the bug

When using vi.spyOn(Intl, 'RelativeTimeFormat') or vi.spyOn(Intl, 'ListFormat'), the constructor can no longer be called due to:

Constructor Intl.RelativeTimeFormat requires 'new'

Note that Intl.DateTimeFormat works flawlessly.

Reproduction

StackBlitz

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (6) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @vitest/ui: latest => 2.0.2 
    vite: latest => 5.3.3 
    vitest: latest => 2.0.2 

Used Package Manager

npm

Validations

amannn avatar Jul 12 '24 10:07 amannn