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
chore: correctly resolve url sass bundle in Angular CT #25191
Merged
Merged
Conversation
This file contains 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
Thanks for taking the time to open a PR!
|
4 tasks
rockindahizzy
approved these changes
Dec 16, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
ZachJW34
approved these changes
Dec 16, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
User facing changelog
Correctly resolve
url
inscss
(egbackground-image: url(....)
).Additional details
Angular uses webpack internally. It maps urls in sass via
resolve-url-loader
. We need to provide the correct root url - Angular assumes/
by default, but we serve the assets on the dev server on__cypress/src
.Known edge case:
url
in.css
files doesn't map properly..scss
and.sass
do, though. We could hack it to force.css
usesass-loader
for css, but that's not really ideal - it's not what their app would be using in prod. In general, to work around it for now, we can just recommend using.scss
- it's in Angular out of the box, and it's a superset of CSS .This is also an issue for other frameworks (like React) using
url
inscss
. Basically, anything usingurl
incss
andscss
may exhibit this bug. The problem is more fundamental - I think we are not routing some asset requests properly for CT. I tried tweaking the routing in #25120 but it's too involved right now, and a bit more risky to touch routing, since that impacts the entire of Cypress. This routing issue (at least, I think it's routing) bleeds into other things, too, like this bug: mswjs/msw#744.I will spend more time thinking about this in the future, but for now I'd like to get Angular working out of the box. Showing images is a pretty basic thing that should work. This PR is the most simple and low risk way to do so.
Steps to test
Grab the repro in the issue from the original user and verify the problem where the images don't show no longer is a problem.
How has the user experience changed?
url
for images correctly resolves.PR Tasks
cypress-documentation
?type definitions
?