Closed
Conversation
Pull Request Test Coverage Report for Build 15479477412Details
💛 - Coveralls |
Member
|
When would window be defined but window.location doesn't exist? |
Contributor
Author
|
I use |
Member
|
Ok let me think about the best way to do this. I'll add a fix later today, will close this for now. |
Contributor
Author
|
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: |
Member
|
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>
|
Contributor
Author
|
One more error in case Adding |
Member
|
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>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.