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
|
* found when Flow v0.54 was deployed. To see the error delete this comment and
|
||||||
* run Flow. */
|
* run Flow. */
|
||||||
const createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction');
|
const createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction');
|
||||||
|
const generate = require('babel-generator').default;
|
||||||
|
|
||||||
const nodeFiles = RegExp([
|
const nodeFiles = RegExp([
|
||||||
'/local-cli/',
|
'/local-cli/',
|
||||||
|
@ -47,7 +48,7 @@ module.exports = {
|
||||||
).code;
|
).code;
|
||||||
}
|
}
|
||||||
|
|
||||||
return transformer.transform({
|
const {ast} = transformer.transform({
|
||||||
filename: file,
|
filename: file,
|
||||||
localPath: file,
|
localPath: file,
|
||||||
options: {
|
options: {
|
||||||
|
@ -58,7 +59,17 @@ module.exports = {
|
||||||
retainLines: true,
|
retainLines: true,
|
||||||
},
|
},
|
||||||
src,
|
src,
|
||||||
}).code;
|
});
|
||||||
|
|
||||||
|
return generate(ast, {
|
||||||
|
code: true,
|
||||||
|
comments: false,
|
||||||
|
compact: false,
|
||||||
|
filename: file,
|
||||||
|
retainLines: true,
|
||||||
|
sourceFileName: file,
|
||||||
|
sourceMaps: true,
|
||||||
|
}, src).code;
|
||||||
},
|
},
|
||||||
|
|
||||||
getCacheKey: createCacheKeyFunction([
|
getCacheKey: createCacheKeyFunction([
|
||||||
|
|
Loading…
Reference in New Issue