diff --git a/packages/babel-jest/src/index.js b/packages/babel-jest/src/index.js index 56af59058ef8..b2306177b9ae 100644 --- a/packages/babel-jest/src/index.js +++ b/packages/babel-jest/src/index.js @@ -123,7 +123,9 @@ const createTransformer = (options: any) => { ]); } - return babelTransform(src, theseOptions).code; + // babel v7 might return null in the case when the file has been ignored. + const transformResult = babelTransform(src, theseOptions); + return transformResult ? transformResult.code : src; }, }; };