diff --git a/src/lib/utils.js b/src/lib/utils.js index 744138899d6d..f167c1c0f012 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -18,6 +18,7 @@ var DEFAULT_CONFIG_VALUES = { globals: {}, moduleFileExtensions: ['js', 'json'], moduleLoader: require.resolve('../HasteModuleLoader/HasteModuleLoader'), + preprocessorIgnorePatterns: [], modulePathIgnorePatterns: [], testDirectoryName: '__tests__', testEnvironment: require.resolve('../JSDomEnvironment'), @@ -193,6 +194,7 @@ function normalizeConfig(config) { )); break; + case 'preprocessorIgnorePatterns': case 'testPathIgnorePatterns': case 'modulePathIgnorePatterns': case 'unmockedModulePathPatterns': @@ -329,7 +331,10 @@ function readAndPreprocessFileContent(filePath, config) { fileData = fileData.replace(/^#!.*/, ''); } - if (config.scriptPreprocessor) { + if (config.scriptPreprocessor && + !config.preprocessorIgnorePatterns.some(function(pattern) { + return pattern.test(filePath); + })) { try { fileData = require(config.scriptPreprocessor).process(fileData, filePath); } catch (e) {