jest-resolve
Advanced tools
Comparing version 30.0.0-alpha.2 to 30.0.0-alpha.3
@@ -320,5 +320,5 @@ /*! | ||
}); | ||
} catch (e) { | ||
if (!(e && (e.code === 'ENOENT' || e.code === 'ENOTDIR'))) { | ||
throw e; | ||
} catch (error) { | ||
if (!(error && (error.code === 'ENOENT' || error.code === 'ENOTDIR'))) { | ||
throw error; | ||
} | ||
@@ -503,3 +503,3 @@ } | ||
function nodeModulesPaths(basedir, options) { | ||
const modules = options && options.moduleDirectory ? Array.from(options.moduleDirectory) : ['node_modules']; | ||
const modules = options && options.moduleDirectory ? [...options.moduleDirectory] : ['node_modules']; | ||
@@ -527,3 +527,3 @@ // ensure that `basedir` is an absolute path at this point, | ||
let parsed = path().parse(physicalBasedir); | ||
while (parsed.dir !== paths[paths.length - 1]) { | ||
while (parsed.dir !== paths.at(-1)) { | ||
paths.push(parsed.dir); | ||
@@ -619,4 +619,2 @@ parsed = path().parse(parsed.dir); | ||
/* eslint-disable local/prefer-spread-eventually */ | ||
const NATIVE_PLATFORM = 'native'; | ||
@@ -688,9 +686,9 @@ | ||
moduleDirectory: options.moduleDirectory, | ||
paths: paths ? (nodePaths || []).concat(paths) : nodePaths, | ||
paths: paths ? [...(nodePaths || []), ...paths] : nodePaths, | ||
rootDir: options.rootDir | ||
}); | ||
} catch (e) { | ||
} catch (error) { | ||
// we always wanna throw if it's an internal import | ||
if (options.throwIfNotFound || path.startsWith('#')) { | ||
throw e; | ||
throw error; | ||
} | ||
@@ -720,10 +718,10 @@ } | ||
moduleDirectory: options.moduleDirectory, | ||
paths: paths ? (nodePaths || []).concat(paths) : nodePaths, | ||
paths: paths ? [...(nodePaths || []), ...paths] : nodePaths, | ||
rootDir: options.rootDir | ||
}); | ||
return result; | ||
} catch (e) { | ||
} catch (error) { | ||
// we always wanna throw if it's an internal import | ||
if (options.throwIfNotFound || path.startsWith('#')) { | ||
throw e; | ||
throw error; | ||
} | ||
@@ -905,3 +903,3 @@ } | ||
const defaultPlatform = this._options.defaultPlatform; | ||
const extensions = this._options.extensions.slice(); | ||
const extensions = [...this._options.extensions]; | ||
if (this._supportsNativePlatform) { | ||
@@ -930,3 +928,3 @@ extensions.unshift(...this._options.extensions.map(ext => `.${NATIVE_PLATFORM}${ext}`)); | ||
if (hastePackage) { | ||
return path().join.apply(path(), [path().dirname(hastePackage)].concat(parts)); | ||
return path().join(path().dirname(hastePackage), ...parts); | ||
} | ||
@@ -940,3 +938,3 @@ return null; | ||
_getMapModuleName(matches) { | ||
return matches ? moduleName => moduleName.replace(/\$([0-9]+)/g, (_, index) => matches[parseInt(index, 10)] || '') : moduleName => moduleName; | ||
return matches ? moduleName => moduleName.replaceAll(/\$(\d+)/g, (_, index) => matches[Number.parseInt(index, 10)] || '') : moduleName => moduleName; | ||
} | ||
@@ -1000,3 +998,3 @@ _isAliasModule(moduleName) { | ||
}); | ||
if (paths[paths.length - 1] === undefined) { | ||
if (paths.at(-1) === undefined) { | ||
// circumvent node-resolve bug that adds `undefined` as last item. | ||
@@ -1355,3 +1353,3 @@ paths.pop(); | ||
const BULLET = _chalk().default.bold('\u25cf '); | ||
const BULLET = _chalk().default.bold('\u25CF '); | ||
const DOCUMENTATION_NOTE = ` ${_chalk().default.bold('Configuration Documentation:')} | ||
@@ -1362,6 +1360,6 @@ https://jestjs.io/docs/configuration | ||
const replaceRootDirInPath = (rootDir, filePath) => { | ||
if (!/^<rootDir>/.test(filePath)) { | ||
if (!filePath.startsWith('<rootDir>')) { | ||
return filePath; | ||
} | ||
return path().resolve(rootDir, path().normalize(`./${filePath.substr('<rootDir>'.length)}`)); | ||
return path().resolve(rootDir, path().normalize(`./${filePath.slice('<rootDir>'.length)}`)); | ||
}; | ||
@@ -1368,0 +1366,0 @@ const resolveWithPrefix = (resolver, { |
{ | ||
"name": "jest-resolve", | ||
"version": "30.0.0-alpha.2", | ||
"version": "30.0.0-alpha.3", | ||
"repository": { | ||
@@ -24,6 +24,6 @@ "type": "git", | ||
"graceful-fs": "^4.2.9", | ||
"jest-haste-map": "30.0.0-alpha.2", | ||
"jest-haste-map": "30.0.0-alpha.3", | ||
"jest-pnp-resolver": "^1.2.2", | ||
"jest-util": "30.0.0-alpha.2", | ||
"jest-validate": "30.0.0-alpha.2", | ||
"jest-util": "30.0.0-alpha.3", | ||
"jest-validate": "30.0.0-alpha.3", | ||
"resolve": "^1.20.0", | ||
@@ -46,3 +46,3 @@ "resolve.exports": "^2.0.0", | ||
}, | ||
"gitHead": "c04d13d7abd22e47b0997f6027886aed225c9ce4" | ||
"gitHead": "e267aff33d105399f2134bad7c8f82285104f3da" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64572
1736
+ Added@jest/schemas@30.0.0-alpha.3(transitive)
+ Added@jest/types@30.0.0-alpha.3(transitive)
+ Added@sinclair/typebox@0.32.35(transitive)
+ Addedjest-get-type@30.0.0-alpha.3(transitive)
+ Addedjest-haste-map@30.0.0-alpha.3(transitive)
+ Addedjest-regex-util@30.0.0-alpha.3(transitive)
+ Addedjest-util@30.0.0-alpha.3(transitive)
+ Addedjest-validate@30.0.0-alpha.3(transitive)
+ Addedjest-worker@30.0.0-alpha.3(transitive)
+ Addedpretty-format@30.0.0-alpha.3(transitive)
- Removed@jest/schemas@30.0.0-alpha.2(transitive)
- Removed@jest/types@30.0.0-alpha.2(transitive)
- Removed@sinclair/typebox@0.31.28(transitive)
- Removedjest-get-type@30.0.0-alpha.2(transitive)
- Removedjest-haste-map@30.0.0-alpha.2(transitive)
- Removedjest-regex-util@30.0.0-alpha.2(transitive)
- Removedjest-util@30.0.0-alpha.2(transitive)
- Removedjest-validate@30.0.0-alpha.2(transitive)
- Removedjest-worker@30.0.0-alpha.2(transitive)
- Removedpretty-format@30.0.0-alpha.2(transitive)
Updatedjest-util@30.0.0-alpha.3
Updatedjest-validate@30.0.0-alpha.3