Skip to content

Commit

Permalink
fix(preprocessor): fix STYLE_URLS_REGEX to not break on multiple new …
Browse files Browse the repository at this point in the history
…lines

Fixes thymikee#136
  • Loading branch information
phenomnomnominal committed Apr 8, 2018
1 parent c57a4b5 commit db7f016
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
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'
],
})`
];

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

0 comments on commit db7f016

Please sign in to comment.