We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
URL
1 parent 6e6ee10 commit 43783cfCopy full SHA for 43783cf
packages/expect/src/jest-utils.ts
@@ -96,7 +96,7 @@ function eq(
96
if (a instanceof Error && b instanceof Error)
97
return a.message === b.message
98
99
- if (a instanceof URL && b instanceof URL)
+ if (typeof URL === 'function' && a instanceof URL && b instanceof URL)
100
return a.href === b.href
101
102
if (Object.is(a, b))
test/core/test/jest-expect-no-url.test.ts
@@ -0,0 +1,10 @@
1
+import { expect, it } from 'vitest'
2
+
3
+// simulate odd environment where URL is monkey-patched or not available
4
+it('jest-expect-no-url', () => {
5
+ (globalThis as any).URL = {}
6
+ expect('hello').toEqual('hello')
7
8
+ delete (globalThis as any).URL
9
10
+})
0 commit comments