Created
October 2, 2018 06:14
-
-
Save rodrigoalmeidaee/a12d0c1e72f277d8c125c3c086607449 to your computer and use it in GitHub Desktop.
list of patches for jest to handle symlinks properly
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 2018-09-10 09:41:20.000000000 -0300 | |
+++ b/node_modules/jest-haste-map/build/crawlers/node.js 2018-09-19 14:27:03.000000000 -0300 | |
@@ -91,7 +91,7 @@ | |
} | |
function findNative(roots, extensions, ignore, callback) { | |
- const args = [].concat(roots); | |
+ const args = ['-L'].concat(roots); | |
args.push('-type', 'f'); | |
if (extensions.length) { | |
args.push('('); | |
--- a/node_modules/jest-haste-map/build/index.js 2018-09-10 09:41:20.000000000 -0300 | |
+++ b/node_modules/jest-haste-map/build/index.js 2018-09-19 14:28:45.000000000 -0300 | |
@@ -289,7 +289,7 @@ | |
retainAllFiles: options.retainAllFiles, | |
roots: Array.from(new Set(options.roots)), | |
throwOnModuleCollision: !!options.throwOnModuleCollision, | |
- useWatchman: options.useWatchman == null ? true : options.useWatchman, | |
+ useWatchman: false, | |
watch: !!options.watch | |
}; | |
this._console = options.console || global.console; | |
@@ -299,6 +299,9 @@ | |
'deprecated. Provide a RegExp instead. See https://github.com/facebook/jest/pull/4063.' | |
); | |
} | |
+ 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}`, | |
--- a/node_modules/jest-resolve/build/default_resolver.js 2018-09-10 09:41:22.000000000 -0300 | |
+++ b/node_modules/jest-resolve/build/default_resolver.js 2018-09-19 14:29:56.000000000 -0300 | |
@@ -123,7 +123,7 @@ | |
if (result) { | |
// Dereference symlinks to ensure we don't create a separate | |
// module instance depending on how it was referenced. | |
- result = (_fs || _load_fs()).default.realpathSync(result); | |
+ // result = (_fs || _load_fs()).default.realpathSync(result); | |
} | |
return result; | |
} | |
--- a/node_modules/jest-runtime/build/script_transformer.js 2018-09-10 09:41:23.000000000 -0300 | |
+++ b/node_modules/jest-runtime/build/script_transformer.js 2018-09-19 14:30:32.000000000 -0300 | |
@@ -274,7 +274,7 @@ | |
} | |
transformSource(filepath, content, instrument) { | |
- const filename = this._getRealPath(filepath); | |
+ const filename = filepath; | |
const transform = this._getTransformer(filename); | |
const cacheFilePath = this._getFileCachePath(filename, content, instrument); | |
let sourceMapPath = cacheFilePath + '.map'; | |
--- a/node_modules/watchpack/lib/DirectoryWatcher.js 2018-04-26 11:12:09.000000000 -0300 | |
+++ b/node_modules/watchpack/lib/DirectoryWatcher.js 2018-09-19 15:10:55.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/node_modules_paths.js 2018-09-10 09:41:22.000000000 -0300 | |
+++ b/node_modules/jest-resolve/build/node_modules_paths.js 2018-09-19 15:36:43.000000000 -0300 | |
@@ -40,7 +40,8 @@ | |
// 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 || _load_realpathNative()).sync)( | |
basedirAbs | |
@@ -49,6 +50,7 @@ | |
// realpath can throw, e.g. on mapped drives | |
physicalBasedir = basedirAbs; | |
} | |
+ */ | |
const paths = [physicalBasedir]; | |
let parsed = (_path || _load_path()).default.parse(physicalBasedir); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment