fix: no pathname setter in some contexts, set during construction #8861
+1
−3
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.
Discussion
Hi there! 👋 I'm part of the team that maintains react-native-firebase and we've been using the
rules-unit-testing
package for a long time, but we've also been carrying around a local patch for it for a long timeOur problem is that in some contexts (react-native in particular) URL.pathname has a getter but not a setter and we run in strict mode, so attempting to assign to URL.pathname results in a runtime error. I understand (via a quick check in jsfiddle) that even with
"use strict";
in other contexts this is not a problem, their URL implementations must differ, but in react-native at least it is an immediate error for us that we must patchThe path is known in advance though, so it may simply be passed in the URL constructor for a functionally equivalent effect, with a very tiny, hopefully visually obviously correct diff. This diff works in our testing (and has in CI for a year or so)
Hopefully we can upstream this small change and drop our patch locally
Thanks for your consideration
Testing
API Changes
us make Firebase APIs better, please propose your change in an issue so that we
can discuss it together.