Update jest preprocessors to use the ast from the transformers
Reviewed By: jeanlauliac Differential Revision: D6390677 fbshipit-source-id: e023fc32188c2d601b35d7a2e3f0f6f8af067962
This commit is contained in:
parent
7fd5aa84a1
commit
2ae255a6ea
|
@ -25,6 +25,7 @@ const babelRegisterOnly = require('metro-bundler/src/babelRegisterOnly');
|
|||
* found when Flow v0.54 was deployed. To see the error delete this comment and
|
||||
* run Flow. */
|
||||
const createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction');
|
||||
const generate = require('babel-generator').default;
|
||||
|
||||
const nodeFiles = RegExp([
|
||||
'/local-cli/',
|
||||
|
@ -47,7 +48,7 @@ module.exports = {
|
|||
).code;
|
||||
}
|
||||
|
||||
return transformer.transform({
|
||||
const {ast} = transformer.transform({
|
||||
filename: file,
|
||||
localPath: file,
|
||||
options: {
|
||||
|
@ -58,7 +59,17 @@ module.exports = {
|
|||
retainLines: true,
|
||||
},
|
||||
src,
|
||||
}).code;
|
||||
});
|
||||
|
||||
return generate(ast, {
|
||||
code: true,
|
||||
comments: false,
|
||||
compact: false,
|
||||
filename: file,
|
||||
retainLines: true,
|
||||
sourceFileName: file,
|
||||
sourceMaps: true,
|
||||
}, src).code;
|
||||
},
|
||||
|
||||
getCacheKey: createCacheKeyFunction([
|
||||
|
|
Loading…
Reference in New Issue