Skip to content
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

Multi-lined styleUrls seems to break tests. #136

Closed
phenomnomnominal opened this issue Apr 4, 2018 · 9 comments
Closed

Multi-lined styleUrls seems to break tests. #136

phenomnomnominal opened this issue Apr 4, 2018 · 9 comments

Comments

@phenomnomnominal
Copy link
Contributor

Components that are declared like this:

@Component({
    selector: 'whatever',
    styleUrls: [
        '../some-styles.scss',
        '../some-more-styles.scss',
        '../even-more-styles.scss',
    ]

break the regex of the preprocessor, resulting in:

SyntaxError: The string did not match the expected pattern.
      
      at XMLHttpRequest.open [as __zone_symbol__open] (../../node_modules/jsdom/lib/jsdom/living/xmlhttprequest.js:470:15)

Putting the styleUrls all on one line fixes this issue.

Seems to me that the regex could just be styleUrls:\s*\[[^\]]*\]? Unless I'm really missing something. Let me know and I will make a PR.

@thymikee
Copy link
Owner

thymikee commented Apr 4, 2018

That's a regex issue. Would you mind sending a PR with this fix an test case? :)

@Naooki
Copy link

Naooki commented Apr 11, 2018

Getting the same error on templateUrl.

@thymikee
Copy link
Owner

@Naooki can you create an issue with the reproducible example?

@Naooki
Copy link

Naooki commented Apr 12, 2018

@thymikee Sorry, my problem was that I've forgotten to change preprocessor in the transform section of jest config. It was ts-jest, instead of jest-preset-angular preprocessor. Interesting though that I've got the same error mentioned here.
But now everything is fine, thanks for a great work)

@jeremyfry
Copy link

I had the same issue and the commit referenced fixed it. Any eta on that getting pushed out to NPM? Pulling from the github repo for now.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 27, 2018

@jeremyfry unfortunately you have to wait for the fix patch to release.
cc @thymikee

@thymikee
Copy link
Owner

published v5.2.2

@jeremyfry
Copy link

@thymikee Thanks! I'll try to put in a new pr this week as well. I'm cleaning up a codebase that's a bit of a mess and it looks like this regex fails on some of the messier formats for some reason. I just forced some formatting for now, but I'll try to make it more robust.

@thymikee
Copy link
Owner

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants