You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -257,12 +261,12 @@ async function loadConfigFile(configFile) {
257
261
thrownewError(`Config file ${configFile} can't be loaded`)
258
262
}
259
263
260
-
functionloadConfigFileSync(configFile){
264
+
asyncfunctionloadConfigFileSync(configFile){
261
265
constextensionName=path.extname(configFile)
262
266
263
267
if(extensionName==='.ts'){
264
268
try{
265
-
require('ts-node/register')
269
+
awaitimport('ts-node/register');
266
270
}catch(err){
267
271
console.log('ts-node package is required to parse codecept.conf.ts config correctly')
268
272
}
@@ -276,8 +280,10 @@ function loadConfigFileSync(configFile) {
276
280
`Config file ${configFile} is an ES module and cannot be loaded synchronously. The file contains 'type: module' in package.json or uses .mjs extension. Please use async configuration loading or switch your config to CommonJS format.`,
277
281
)
278
282
}else{
279
-
// Use require for CommonJS modules
280
-
returnConfig.create(require(configFile).config)
283
+
// Use dynamic import for CommonJS modules too in ESM context
0 commit comments