Allow URL tests to run in non-browser runtimes #1295
Merged
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.
Hi! I'm working on runtime-compat, which is a new project to collect some of the same data as BCD, but for non-browser JS runtimes. You can see its current state here: https://runtime-compat.unjs.io/ We've been using your tests from this project to track web API coverage, which are great for most purposes (thanks!). However there are a few cases where we're getting false failures because of implementation details in the tests. I hope you're OK with me contributing a small fix that will allow these tests to run outside the browser.
I've opened this PR to work around one of the main problems. All of the runtimes that we're testing support
URL
, however they don't setlocation.href
. The URL and Request tests are showing as failures for all of these features, even though they are supported, because the tests either use an empty string, a relative URL orlocation.href
, none of which work outside the browser. In this PR I've replaced the empty string andlocation.href
withhttp://example.com
. This shouldn't affect the tests for browsers, but will allow our tested runtimes to run the tests correctly.Let me know if you have any questions, or if you'd like to join our Discord where we're organising this. Thanks!