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

fix(@ngtools/webpack): one star replacement should be preceded by slash #4701

Closed
wants to merge 1 commit into from
Closed

Conversation

hccampos
Copy link

When building a project with AoT enabled, I noticed that .spec.ts files were not being excluded properly. This was happening because the pattern **/*.spec.ts triggered the two-stars replacement:

"**/*.spec.ts".replace(/\*\*/g, '(?:.*)')
--> "(?:.*)/*.spec.ts"

And then the one star replacement would replace the * inserted by the previous replacement:

"(?:.*)/*.spec.ts".replace(/\*/g, '(?:[^/]*)')
"(?:.(?:[^/]*))/(?:[^/]*).spec.ts"

With this PR, the single-star replacement expects a slash before the star, i.e. /*.spec.ts, so:

"(?:.*)/*.spec.ts".replace(/\/\*/g, '(?:[^/]*)')
"(?:.*)(?:[^/]*)\.spec\.ts"

Which then properly excludes the spec files. This doesn't handle the case where the pattern is in the form of **/something-*.spec.ts, but I am not sure that is super common.

Since I am not super familiar with the codebase, If you guys know of a simpler or better way to fix this problem, I'd welcome feedback. Or feel free to implement/refactor yourselves.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

@hccampos
Copy link
Author

Nope, looks like @googlebot is still not happy @filipesilva

@googlebot
Copy link

CLAs look good, thanks!

@hccampos
Copy link
Author

Yay, now it is finally happy :)

@filipesilva
Copy link
Contributor

Followup from #4455

@filipesilva filipesilva requested a review from hansl February 14, 2017 20:46
Copy link
Contributor

@hansl hansl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@hansl hansl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually xi18n needs this change as well.

@filipesilva
Copy link
Contributor

Superseded by #4868, which allows user provided excludes and adds them to tsconfig proper.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants