Skip to content

Commit

Permalink
Merge pull request jestjs#303 from zpao/benjamn-preprocessorIgnorePat…
Browse files Browse the repository at this point in the history
…terns

Support config.preprocessorIgnorePatterns
  • Loading branch information
zpao committed May 6, 2015
2 parents 489b489 + f4a6871 commit 216ed96
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -194,6 +195,7 @@ function normalizeConfig(config) {
));
break;

case 'preprocessorIgnorePatterns':
case 'testPathIgnorePatterns':
case 'modulePathIgnorePatterns':
case 'unmockedModulePathPatterns':
Expand Down Expand Up @@ -331,7 +333,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) {
Expand Down

0 comments on commit 216ed96

Please sign in to comment.