Skip to content

URL class name when using jsdom is URL$1 starting with v4.07 #9761

@TomerAberbach

Description

@TomerAberbach

Describe the bug

Starting with vitest v4.07 the URL class name when using jsdom is URL$1. I would expect it to be URL instead. I think this is probably from #8935.

This is a problem because some libraries, like devalue, depend on the string names of builtin classes being correct. They don't use instanceof because they want to work on objects from other realms.

Reproduction

  1. Clone https://github.com/TomerAberbach/vitest-url-bug
  2. Run pnpm test

System Info

System:
    OS: macOS 14.6.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 7.62 GB / 32.00 GB
    Shell: 4.4.0 - /opt/homebrew/bin/fish
  Binaries:
    Node: 25.6.1 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 11.9.0 - /opt/homebrew/bin/npm
    pnpm: 10.29.3 - /opt/homebrew/bin/pnpm
    bun: 1.3.9 - /opt/homebrew/bin/bun
    Deno: 2.6.10 - /opt/homebrew/bin/deno
  Browsers:
    Chrome: 145.0.7632.117
    Edge: 145.0.3800.82
    Firefox: 147.0.4
    Safari: 17.6
  npmPackages:
    vitest: 4.0.7 => 4.0.7

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions