Forked from rodrigoalmeidaee/symlink_patches.diff
Last active
November 22, 2019 20:51
-
-
Save CarlaTeo/710c56f1d481151ce96da823ed9e3cb7 to your computer and use it in GitHub Desktop.
list of patches for jest to handle symlinks properly [ jest 24.7.1 ]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/node_modules/jest-haste-map/build/crawlers/node.js 2019-05-10 13:03:51.000000000 -0300 | |
+++ b/node_modules/jest-haste-map/build/crawlers/node.js 2019-05-10 13:10:49.000000000 -0300 | |
@@ -165,7 +165,7 @@ | |
} | |
function findNative(roots, extensions, ignore, callback) { | |
- const args = Array.from(roots); | |
+ const args = ['-L'].concat(Array.from(roots)); | |
args.push('-type', 'f'); | |
if (extensions.length) { | |
--- a/node_modules/jest-haste-map/build/index.js 2019-05-10 13:03:58.000000000 -0300 | |
+++ b/node_modules/jest-haste-map/build/index.js 2019-05-10 13:17:34.000000000 -0300 | |
@@ -404,7 +404,7 @@ | |
roots: Array.from(new Set(options.roots)), | |
skipPackageJson: !!options.skipPackageJson, | |
throwOnModuleCollision: !!options.throwOnModuleCollision, | |
- useWatchman: options.useWatchman == null ? true : options.useWatchman, | |
+ useWatchman: false, | |
watch: !!options.watch | |
}; | |
this._console = options.console || global.console; | |
@@ -440,6 +440,10 @@ | |
} | |
} | |
+ if (options.useWatchman) { | |
+ this._console.warn('--useWatchman has been disabled due to issues with symlinked files, sorry :-/'); | |
+ } | |
+ | |
this._cachePath = HasteMap.getCacheFilePath( | |
this._options.cacheDirectory, | |
`haste-map-${this._options.name}-${rootDirHash}`, | |
--- a/node_modules/jest-resolve/build/defaultResolver.js 2019-05-10 13:04:09.000000000 -0300 | |
+++ b/node_modules/jest-resolve/build/defaultResolver.js 2019-05-10 13:11:17.000000000 -0300 | |
@@ -137,7 +137,7 @@ | |
if (result) { | |
// Dereference symlinks to ensure we don't create a separate | |
// module instance depending on how it was referenced. | |
- result = _fs().default.realpathSync(result); | |
+ // result = _fs().default.realpathSync(result); | |
} | |
return result; | |
--- a/node_modules/@jest/transform/build/ScriptTransformer.js 2019-05-10 13:04:16.000000000 -0300 | |
+++ b/node_modules/@jest/transform/build/ScriptTransformer.js 2019-05-10 13:11:26.000000000 -0300 | |
@@ -348,7 +348,7 @@ | |
} | |
transformSource(filepath, content, instrument) { | |
- const filename = this._getRealPath(filepath); | |
+ const filename = filepath; | |
const transform = this._getTransformer(filename); | |
--- a/node_modules/watchpack/lib/DirectoryWatcher.js 2019-05-10 13:04:56.000000000 -0300 | |
+++ b/node_modules/watchpack/lib/DirectoryWatcher.js 2019-05-10 13:11:31.000000000 -0300 | |
@@ -53,7 +53,7 @@ | |
this.watcher = chokidar.watch(directoryPath, { | |
ignoreInitial: true, | |
persistent: true, | |
- followSymlinks: false, | |
+ followSymlinks: true, | |
depth: 0, | |
atomic: false, | |
alwaysStat: true, | |
--- a/node_modules/jest-resolve/build/nodeModulesPaths.js 2019-05-10 13:04:43.000000000 -0300 | |
+++ b/node_modules/jest-resolve/build/nodeModulesPaths.js 2019-05-10 13:11:45.000000000 -0300 | |
@@ -55,14 +55,14 @@ | |
} // The node resolution algorithm (as implemented by NodeJS and TypeScript) | |
// traverses parents of the physical path, not the symlinked path | |
- let physicalBasedir; | |
+ let physicalBasedir = basedirAbs; | |
- try { | |
- physicalBasedir = (0, _realpathNative().sync)(basedirAbs); | |
- } catch (err) { | |
- // realpath can throw, e.g. on mapped drives | |
- physicalBasedir = basedirAbs; | |
- } | |
+ // try { | |
+ // physicalBasedir = (0, _realpathNative().sync)(basedirAbs); | |
+ // } catch (err) { | |
+ // // realpath can throw, e.g. on mapped drives | |
+ // physicalBasedir = basedirAbs; | |
+ // } | |
const paths = [physicalBasedir]; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
IDK what watchpack is doing here; AFAIK it is not a dependency of jest.