jsdom / whatwg-url

An implementation of the WHATWG URL Standard in JavaScript
https://jsdom.github.io/whatwg-url/
MIT License
371 stars 94 forks source link

Cannot convert undefined or null to object at Function.getPrototypeOf #276

Closed intrepidOlivia closed 3 months ago

intrepidOlivia commented 3 months ago

I found this issue while I was looking for a solution to this error I ran into.

This error occurs when I try to import the whatwg-url library into my unit tests, using version 8.2.0 and above (8.1.0 works properly).

    TypeError: Cannot convert undefined or null to object
        at Function.getPrototypeOf (<anonymous>)
      at Object.<anonymous> (node_modules/whatwg-url/dist/utils.js:48:39)
      at Object.<anonymous> (node_modules/whatwg-url/dist/URL.js:4:15)
      at Object.<anonymous> (node_modules/whatwg-url/webidl2js-wrapper.js:3:13)
      at Object.<anonymous> (node_modules/whatwg-url/index.js:3:34)
      at Object.<anonymous> (test/sample_test.spec.ts:1:1)

I have a minimal test case for this error. There must be something about it that makes it an edge case, since this error doesn't seem to have caused too many problems in the dev community since version 8 was released. But in my current project it is preventing me updating this library to the most recent version.

Minimal test case: https://github.com/intrepidOlivia/whatwg_test_case

Originally posted by @intrepidOlivia in https://github.com/jsdom/whatwg-url/issues/274#issuecomment-2291679556

domenic commented 3 months ago

Closing per https://github.com/jsdom/whatwg-url/issues/274#issuecomment-2292599499