codeceptjs 4.0.1-beta.10 → 4.0.1-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -168,6 +168,7 @@ const __dirname = __dirname_fn(__filename);
168
168
  /from\s+['"](\..+?)(?:\.ts)?['"]/g,
169
169
  (match, importPath) => {
170
170
  let resolvedPath = path.resolve(fileBaseDir, importPath)
171
+ const originalExt = path.extname(importPath)
171
172
 
172
173
  // Handle .js extension that might be .ts
173
174
  if (resolvedPath.endsWith('.js')) {
@@ -181,6 +182,8 @@ const __dirname = __dirname_fn(__filename);
181
182
  }
182
183
  return `from '${relPath}'`
183
184
  }
185
+ // Keep .js extension as-is (might be a real .js file)
186
+ return match
184
187
  }
185
188
 
186
189
  // Try with .ts extension
@@ -197,6 +200,18 @@ const __dirname = __dirname_fn(__filename);
197
200
  return `from '${relPath}'`
198
201
  }
199
202
 
203
+ // If the import doesn't have a standard module extension (.js, .mjs, .cjs, .json)
204
+ // add .js for ESM compatibility
205
+ // This handles cases where:
206
+ // 1. Import has no real extension (e.g., "./utils" or "./helper")
207
+ // 2. Import has a non-standard extension that's part of the name (e.g., "./abstract.helper")
208
+ const standardExtensions = ['.js', '.mjs', '.cjs', '.json', '.node']
209
+ const hasStandardExtension = standardExtensions.includes(originalExt.toLowerCase())
210
+
211
+ if (!hasStandardExtension) {
212
+ return match.replace(importPath, importPath + '.js')
213
+ }
214
+
200
215
  // Otherwise, keep the import as-is
201
216
  return match
202
217
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "4.0.1-beta.10",
3
+ "version": "4.0.1-beta.11",
4
4
  "type": "module",
5
5
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
6
6
  "keywords": [