From c48b184d3fba59e38138927da1ace71225e1398c Mon Sep 17 00:00:00 2001 From: ahanriat Date: Mon, 18 Jan 2016 06:02:16 -0800 Subject: [PATCH] Fix jest preprocessor script Summary: Related to #3999 There is an issue with the `preprocessor` script when using node >=5 as it uses npm 3. ~~There are (at least) two solutions, (I'm submitting the first one):~~ - ~~specify min required node version to 5.x and modify [this the preprocessor script](https://github.com/facebook/react-native/blob/0.16-stable/jestSupport/preprocessor.js#L29) to match npm 3 requirements~~ - ~~specifify node version >= 4.x and < 5.x and let the preprocessor script as it is~~ **EDIT**: Using `require.resolve` will do the trick ! -- Thank you guys for this amazing project by the way ;) Closes https://github.com/facebook/react-native/pull/4903 Reviewed By: svcscm Differential Revision: D2838759 Pulled By: androidtrunkagent fb-gh-sync-id: ebb12f225a519ea23afc4f013bb063a920193719 --- jestSupport/preprocessor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jestSupport/preprocessor.js b/jestSupport/preprocessor.js index b2006b7d24ce7f..7d1376b27dde52 100644 --- a/jestSupport/preprocessor.js +++ b/jestSupport/preprocessor.js @@ -26,6 +26,6 @@ module.exports = { getCacheKey: createCacheKeyFunction([ __filename, path.join(__dirname, '../packager/transformer.js'), - path.join(__dirname, '../node_modules/babel-core/package.json'), + require.resolve('babel-core/package.json'), ]), };