From bd5b5692fd6ccc79293edd9608decd2a717cf8bc Mon Sep 17 00:00:00 2001 From: Nierrrrrrr Date: Tue, 26 Jun 2018 13:42:48 +0800 Subject: [PATCH] fix: transformer breaking on spaces before colon (#165) Fixes #164 --- __tests__/preprocessor.test.js | 10 ++++++++++ preprocessor.js | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/__tests__/preprocessor.test.js b/__tests__/preprocessor.test.js index 41b833afc5..6e96e30c1a 100644 --- a/__tests__/preprocessor.test.js +++ b/__tests__/preprocessor.test.js @@ -45,6 +45,16 @@ 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', + '../../box.component.scss', + '../media-box.component.scss', + './media-box-h0.component.scss' + ], })` ]; diff --git a/preprocessor.js b/preprocessor.js index 04ac7a1a8f..7622e5935c 100644 --- a/preprocessor.js +++ b/preprocessor.js @@ -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*\[[^\]]*\]/g; +const TEMPLATE_URL_REGEX = /templateUrl\s*:\s*('|")(\.\/){0,}(.*)('|")/g; +const STYLE_URLS_REGEX = /styleUrls\s*:\s*\[[^\]]*\]/g; const ESCAPE_TEMPLATE_REGEX = /(\${|\`)/g; module.exports.process = (src, path, config, transformOptions) => {