Description
- Version: v10.8.0
- Platform: Windows 10 64-bit
- Subsystem: url
The (WHATWG) URL object's internal "context" symbol is exposed as an enumerable property on URL
instances. This leads to it being considered for comparison by testing frameworks and the like.
For example, see https://repl.it/repls/StaidUnlinedFolder, wherein Jest considers new URL('./foo', 'https://example.com/')
and new URL('https://example.com/foo')
different because the former has flags: 496, and the latter has flags: 400.
The best solution would probably be using WeakMaps, or V8 private symbols. But you may be able to just make the url[context]
property non-enumerable, and maybe that would placate Jest? Or even just reset url[context].flags
after you're done parsing, so that even if your internals are exposed, you don't have this weird path-dependence.
/cc @nodejs/url