MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / resolveImportModulePath

Function resolveImportModulePath

lib/utils.js:42–56  ·  view source on GitHub ↗
(modulePath)

Source from the content-addressed store, hash-verified

40}
41
42export const resolveImportModulePath = function (modulePath) {
43 // 1. If it's an absolute path, convert to a file:// URL
44 if (path.isAbsolute(modulePath)) {
45 return pathToFileURL(modulePath).href;
46 }
47
48 // 2. If it's a relative path (starts with ./ or ../), resolve it fully
49 if (modulePath.startsWith('./') || modulePath.startsWith('../')) {
50 return modulePath
51 }
52
53 // 3. Otherwise, it's likely a bare NPM module (e.g., 'chai', 'codeceptjs')
54 // Let Node.js resolve it natively from node_modules
55 return modulePath;
56}
57
58export const fileExists = function (filePath) {
59 return fs.existsSync(filePath)

Callers 11

requireHelperFromModuleFunction · 0.90
loadPluginAsyncFunction · 0.90
loadSupportObjectFunction · 0.90
runOnceMethod · 0.90
requireModulesMethod · 0.90
runHooksMethod · 0.90
loadConfigFileFunction · 0.90
loadPromptsFunction · 0.90
_createItemMethod · 0.90
container_test.jsFile · 0.90
dynamicImportFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected