Skip to content

Commit 7033d93

Browse files
committed
relax conditions
1 parent 1a2c30f commit 7033d93

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

lib/utils.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,19 @@ export const isAsyncFunction = function (fn) {
4040
}
4141

4242
export const resolveImportModulePath = function (modulePath) {
43+
// 1. If it's an absolute path, convert to a file:// URL
4344
if (path.isAbsolute(modulePath)) {
44-
return pathToFileURL(modulePath).href
45+
return pathToFileURL(modulePath).href;
4546
}
46-
return modulePath
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;
4756
}
4857

4958
export const fileExists = function (filePath) {

0 commit comments

Comments
 (0)