/**
 * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

'use strict';

const babel = require('babel-core');
const jestPreset = require('babel-preset-jest');

module.exports = {
  process(src, filename) {
    if (babel.util.canCompile(filename)) {
      return babel.transform(src, {
        auxiliaryCommentBefore: ' istanbul ignore next ',
        filename,
        presets: [jestPreset],
        retainLines: true,
      }).code;
    }
    return src;
  },
};

@@ -406,27 +406,245 @@
 );%0A%0A
-module.exports =
+const createTransformer = options =%3E %7B%0A  options = Object.assign(%7B%7D, options, %7B%0A    auxiliaryCommentBefore: ' istanbul ignore next ',%0A    presets: %5BjestPreset%5D,%0A    retainLines: true,%0A  %7D);%0A  delete options.cacheDirectory;%0A%0A  return
  %7B%0A
+  
   pr
@@ -662,24 +662,26 @@
 filename) %7B%0A
+  
     if (babe
@@ -713,24 +713,26 @@
 e)) %7B%0A      
+  
 return babel
@@ -746,14 +746,23 @@
 orm(
+%0A          
 src,
- %7B
 %0A   
@@ -770,74 +770,46 @@
     
-auxiliaryCommentBefore: ' istanbul ignore next ',%0A        
+  Object.assign(%7B%7D, options, %7B
 filename
 ,%0A  
@@ -804,16 +804,18 @@
 filename
+%7D)
 ,%0A      
@@ -820,99 +820,146 @@
     
-presets: %5BjestPreset%5D,%0A        retainLines: true,%0A      %7D).code;%0A    %7D%0A    return src;%0A  %7D,%0A%7D
+).code;%0A      %7D%0A      return src;%0A    %7D,%0A  %7D;%0A%7D;%0A%0Amodule.exports = createTransformer();%0Amodule.exports.createTransformer = createTransformer
 ;%0A

Make babel-jest reusable. (#1333)