Skip to content

Instantly share code, notes, and snippets.

@Globegitter
Created May 16, 2019 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Globegitter/690dd1b97828a3927b436bc11211f139 to your computer and use it in GitHub Desktop.
Save Globegitter/690dd1b97828a3927b436bc11211f139 to your computer and use it in GitHub Desktop.
jest 24.7.1 symlink patches
diff --git a/node_modules/@jest/core/build/runJest.js b/node_modules/@jest/core/build/runJest.js
index 5afb90a..9a2c15b 100644
--- a/node_modules/@jest/core/build/runJest.js
+++ b/node_modules/@jest/core/build/runJest.js
@@ -244,7 +244,7 @@ const processResults = (runResults, options) => {
if (isJSON) {
if (outputFile) {
- const cwd = (0, _realpathNative().sync)(process.cwd());
+ const cwd = process.cwd();
const filePath = _path().default.resolve(cwd, outputFile);
diff --git a/node_modules/@jest/transform/build/ScriptTransformer.js b/node_modules/@jest/transform/build/ScriptTransformer.js
index 81397c7..7589de2 100644
--- a/node_modules/@jest/transform/build/ScriptTransformer.js
+++ b/node_modules/@jest/transform/build/ScriptTransformer.js
@@ -328,7 +328,7 @@ class ScriptTransformer {
}
transformSource(filepath, content, instrument) {
- const filename = this._getRealPath(filepath);
+ const filename = filepath;
const transform = this._getTransformer(filename);
diff --git a/node_modules/babel-plugin-istanbul/lib/index.js b/node_modules/babel-plugin-istanbul/lib/index.js
index 259adb4..102a54f 100644
--- a/node_modules/babel-plugin-istanbul/lib/index.js
+++ b/node_modules/babel-plugin-istanbul/lib/index.js
@@ -27,7 +27,7 @@ function makeShouldSkip() {
var exclude;
return function shouldSkip(file, opts) {
if (!exclude || exclude.cwd !== opts.cwd) {
- var cwd = getRealpath(process.env.NYC_CWD || process.cwd());
+ var cwd = process.env.NYC_CWD || process.cwd();
var nycConfig = process.env.NYC_CONFIG ? JSON.parse(process.env.NYC_CONFIG) : {};
var config = {};
@@ -68,7 +68,7 @@ function makeVisitor(_ref) {
Program: {
enter: function enter(path) {
this.__dv__ = null;
- var realPath = getRealpath(this.file.opts.filename);
+ var realPath = this.file.opts.filename;
if (shouldSkip(realPath, this.opts)) {
return;
@@ -101,7 +101,7 @@ function makeVisitor(_ref) {
var result = this.__dv__.exit(path);
if (this.opts.onCover) {
- this.opts.onCover(getRealpath(this.file.opts.filename), result.fileCoverage);
+ this.opts.onCover(this.file.opts.filename, result.fileCoverage);
}
}
}
diff --git a/node_modules/istanbul-api/lib/file-matcher.js b/node_modules/istanbul-api/lib/file-matcher.js
index d926363..587d5d4 100644
--- a/node_modules/istanbul-api/lib/file-matcher.js
+++ b/node_modules/istanbul-api/lib/file-matcher.js
@@ -18,8 +18,8 @@ function filesFor(options, callback) {
let root = options.root;
let includes = options.includes;
let excludes = options.excludes;
- const realpath = options.realpath;
- const relative = options.relative;
+ const realpath = false;
+ const relative = true;
root = root || process.cwd();
includes = includes && Array.isArray(includes) ? includes : ['**/*.js'];
@@ -35,6 +35,7 @@ function filesFor(options, callback) {
return callback(err);
}
if (relative) {
+ console.log("istanbul", files)
return callback(err, files);
}
@@ -62,8 +63,8 @@ function matcherFor(options, callback) {
options = null;
}
options = options || {};
- options.relative = false; //force absolute paths
- options.realpath = true; //force real paths (to match Node.js module paths)
+ options.relative = true; //force absolute paths
+ options.realpath = false; //force real paths (to match Node.js module paths)
filesFor(options, (err, files) => {
const fileMap = Object.create(null);
diff --git a/node_modules/jest-cli/build/cli/index.js b/node_modules/jest-cli/build/cli/index.js
index 831a476..46f7570 100644
--- a/node_modules/jest-cli/build/cli/index.js
+++ b/node_modules/jest-cli/build/cli/index.js
@@ -271,7 +271,7 @@ const getProjectListFromCLIArgs = (argv, project) => {
if (!projects.length && process.platform === 'win32') {
try {
- projects.push((0, _realpathNative().sync)(process.cwd()));
+ projects.push(process.cwd());
} catch (err) {
// do nothing, just catch error
// process.binding('fs').realpath can throw, e.g. on mapped drives
diff --git a/node_modules/jest-cli/build/init/index.js b/node_modules/jest-cli/build/init/index.js
index cae2fc2..7f38281 100644
--- a/node_modules/jest-cli/build/init/index.js
+++ b/node_modules/jest-cli/build/init/index.js
@@ -134,7 +134,7 @@ var _default =
/*#__PURE__*/
(function() {
var _ref = _asyncToGenerator(function*(
- rootDir = (0, _realpathNative().sync)(process.cwd())
+ rootDir = process.cwd()
) {
// prerequisite checks
const projectPackageJsonPath = _path().default.join(
diff --git a/node_modules/jest-config/build/getCacheDirectory.js b/node_modules/jest-config/build/getCacheDirectory.js
index 7e64ba6..6ea2cfd 100644
--- a/node_modules/jest-config/build/getCacheDirectory.js
+++ b/node_modules/jest-config/build/getCacheDirectory.js
@@ -50,7 +50,7 @@ const getCacheDirectory = () => {
getuid = _process.getuid;
const tmpdir = _path().default.join(
- (0, _realpathNative().sync)(_os().default.tmpdir()),
+ _os().default.tmpdir(),
'jest'
);
diff --git a/node_modules/jest-config/build/normalize.js b/node_modules/jest-config/build/normalize.js
index ce37c38..c34497a 100644
--- a/node_modules/jest-config/build/normalize.js
+++ b/node_modules/jest-config/build/normalize.js
@@ -428,7 +428,7 @@ const normalizeRootDir = options => {
try {
// try to resolve windows short paths, ignoring errors (permission errors, mostly)
- options.rootDir = (0, _realpathNative().sync)(options.rootDir);
+ options.rootDir = options.rootDir;
} catch (e) {
// ignored
}
@@ -1004,7 +1004,7 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
try {
// try to resolve windows short paths, ignoring errors (permission errors, mostly)
- newOptions.cwd = (0, _realpathNative().sync)(process.cwd());
+ newOptions.cwd = process.cwd();
} catch (e) {
// ignored
}
diff --git a/node_modules/jest-haste-map/build/crawlers/node.js b/node_modules/jest-haste-map/build/crawlers/node.js
index a179225..06106b9 100644
--- a/node_modules/jest-haste-map/build/crawlers/node.js
+++ b/node_modules/jest-haste-map/build/crawlers/node.js
@@ -165,7 +165,7 @@ function find(roots, extensions, ignore, callback) {
}
function findNative(roots, extensions, ignore, callback) {
- const args = Array.from(roots);
+ const args = Array.from(['-L'].concat(roots));
args.push('-type', 'f');
if (extensions.length) {
diff --git a/node_modules/jest-haste-map/build/index.js b/node_modules/jest-haste-map/build/index.js
index eb8d84f..97ec2c1 100644
--- a/node_modules/jest-haste-map/build/index.js
+++ b/node_modules/jest-haste-map/build/index.js
@@ -403,7 +403,7 @@ class HasteMap extends _events().default {
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;
diff --git a/node_modules/jest-resolve/build/defaultResolver.js b/node_modules/jest-resolve/build/defaultResolver.js
index 64e7387..b5b74d3 100644
--- a/node_modules/jest-resolve/build/defaultResolver.js
+++ b/node_modules/jest-resolve/build/defaultResolver.js
@@ -137,7 +137,7 @@ function resolveSync(target, options) {
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;
diff --git a/node_modules/jest-resolve/build/index.js b/node_modules/jest-resolve/build/index.js
index 8e6bfe0..c3a9f27 100644
--- a/node_modules/jest-resolve/build/index.js
+++ b/node_modules/jest-resolve/build/index.js
@@ -57,7 +57,7 @@ function _defineProperty(obj, key, value) {
const NATIVE_PLATFORM = 'native'; // We might be inside a symlink.
const cwd = process.cwd();
-const resolvedCwd = (0, _realpathNative().sync)(cwd) || cwd;
+const resolvedCwd = cwd;
const nodePaths = process.env.NODE_PATH
? process.env.NODE_PATH.split(_path().default.delimiter)
.filter(Boolean) // The resolver expects absolute paths.
diff --git a/node_modules/jest-resolve/build/nodeModulesPaths.js b/node_modules/jest-resolve/build/nodeModulesPaths.js
index 8d9d10f..5d55456 100644
--- a/node_modules/jest-resolve/build/nodeModulesPaths.js
+++ b/node_modules/jest-resolve/build/nodeModulesPaths.js
@@ -55,14 +55,7 @@ function nodeModulesPaths(basedir, options) {
} // The node resolution algorithm (as implemented by NodeJS and TypeScript)
// traverses parents of the physical path, not the symlinked path
- let physicalBasedir;
-
- try {
- physicalBasedir = (0, _realpathNative().sync)(basedirAbs);
- } catch (err) {
- // realpath can throw, e.g. on mapped drives
- physicalBasedir = basedirAbs;
- }
+ let physicalBasedir = basedirAbs;
const paths = [physicalBasedir];
diff --git a/node_modules/jest-runtime/build/cli/index.js b/node_modules/jest-runtime/build/cli/index.js
index 47f4f5d..ff2bbc1 100644
--- a/node_modules/jest-runtime/build/cli/index.js
+++ b/node_modules/jest-runtime/build/cli/index.js
@@ -203,7 +203,7 @@ function run(cliArgv, cliInfo) {
return;
}
- const root = (0, _realpathNative().sync)(process.cwd());
+ const root = process.cwd();
const filePath = _path().default.resolve(root, argv._[0]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment