-
-
Notifications
You must be signed in to change notification settings - Fork 236
Fix missing location error #387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Pull Request Test Coverage Report for Build 15479477412Details
💛 - Coveralls |
When would window be defined but window.location doesn't exist? |
I use |
Ok let me think about the best way to do this. I'll add a fix later today, will close this for now. |
Hi, thanks for the quick response! I tested the fix, but it's still not working in my case. The check should be:
Using just location to check for undefined won't work reliably here, and window.location is also not available in my environment. Error:
|
Can you try v13.0.3?
I changed it to use explicit window.location instead. It's odd that location isn't on your globalThis but window is. Hopefully this fixes it
JonLuca
…On Fri, Jun 06, 2025 at 1:37 PM, AlexHolly < ***@***.*** > wrote:
*AlexHolly* left a comment (APIDevTools/ json-schema-ref-parser#387) (
#387 (comment)
)
@ jonluca ( https://github.com/jonluca )
Hi, thanks for the quick response!
I tested the fix, but it's still not working in my case. The check should
be:
&& typeof location !== "undefined"
Using just location to check for undefined won't work reliably here, and
window.location is also not available in my environment.
Error:
ReferenceError: location is not defined
at Object.cwd
***@***.***\json-schema-ref-parser\dist\lib\util\url.js:93:42)
—
Reply to this email directly, view it on GitHub (
#387 (comment)
) , or unsubscribe (
https://github.com/notifications/unsubscribe-auth/ADDM5MCICZOVTWJFIFAKT733CH3XFAVCNFSM6AAAAAB6WXABQOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSNJQG4ZTOMZVGQ
).
You are receiving this because you were mentioned. Message ID: <APIDevTools/json-schema-ref-parser/pull/387/c2950737354
@ github. com>
|
One more error in case Adding
|
No I don't think that's the responsibility of this library - I don't think it makes sense to add hardcoded url exceptions.
I'd recommend changing the mocked location at which jsdom is running.
…On Fri, Jun 6, 2025 at 16:34, AlexHolly < ***@***.*** > wrote:
*AlexHolly* left a comment (APIDevTools/json-schema-ref-parser#387) (
#387 (comment)
)
One more error in case window.location.href == 'about:blank'
Adding && window.location.href !== 'about:blank' solves the issue
TypeError: Invalid URL
at new URL (node:internal/url:818:25)
at
Object.resolve
***@***.***\json-schema-ref-parser\dist\lib\util\url.js:78:25)
—
Reply to this email directly, view it on GitHub (
#387 (comment)
) , or unsubscribe (
https://github.com/notifications/unsubscribe-auth/ADDM5MGVBMXBTEIUNEPFAN33CIQSFAVCNFSM6AAAAAB6WXABQOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSNJRGIZDIMJUGM
).
You are receiving this because you were mentioned. Message ID: <APIDevTools/json-schema-ref-parser/pull/387/c2951224143
@ github. com>
|
No description provided.