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 STYLE_URLS_REGEX to not break on multiple new lines #139

Merged
merged 3 commits into from
Apr 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions __tests__/preprocessor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,25 @@ const sources = [
'../media-box.component.scss',
'./media-box-h0.component.scss'
],
})`,
`@Component({
selector: 'xc-media-box-h0',
templateUrl: 'media-box-h0.component.html',
styleUrls: [
'../../box.component.scss',
'../media-box.component.scss',
'./media-box-h0.component.scss'
],
})`,
`@Component({
selector: 'xc-media-box-h0',
templateUrl: 'media-box-h0.component.html',
styleUrls: [
'../../../box.component.scss',
'../../box.component.scss',
'../media-box.component.scss',
'./media-box-h0.component.scss'
],
Copy link
Owner

Choose a reason for hiding this comment

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

Looks like this case is not necessary. Can you remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can if you want - it's intention was to make sure I wasn't just making it work for 3 external stylesheets.

})`
];

Expand Down
2 changes: 1 addition & 1 deletion preprocessor.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const process = require('ts-jest/preprocessor.js').process;
const TEMPLATE_URL_REGEX = /templateUrl:\s*('|")(\.\/){0,}(.*)('|")/g;
const STYLE_URLS_REGEX = /styleUrls:\s*\[\s*((?:'|").*\s*(?:'|")).*\s*.*\]/g;
const STYLE_URLS_REGEX = /styleUrls:\s*\[[^\]]*\]/g;
const ESCAPE_TEMPLATE_REGEX = /(\${|\`)/g;

module.exports.process = (src, path, config, transformOptions) => {
Expand Down