codeceptjs 4.0.1-beta.1 → 4.0.1-beta.2
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.
- package/lib/container.js +10 -23
- package/lib/helper/REST.js +2 -1
- package/package.json +1 -1
package/lib/container.js
CHANGED
|
@@ -202,15 +202,6 @@ class Container {
|
|
|
202
202
|
static append(newContainer) {
|
|
203
203
|
container = deepMerge(container, newContainer)
|
|
204
204
|
|
|
205
|
-
// If new helpers are added, set the helpers property on them
|
|
206
|
-
if (newContainer.helpers) {
|
|
207
|
-
for (const name in newContainer.helpers) {
|
|
208
|
-
if (container.helpers[name] && typeof container.helpers[name] === 'object') {
|
|
209
|
-
container.helpers[name].helpers = container.helpers
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
205
|
// If new support objects are added, update the proxy support
|
|
215
206
|
if (newContainer.support) {
|
|
216
207
|
const newProxySupport = createSupportObjects(newContainer.support)
|
|
@@ -301,7 +292,7 @@ async function createHelpers(config) {
|
|
|
301
292
|
if (!HelperClass) {
|
|
302
293
|
const helperResult = requireHelperFromModule(helperName, config)
|
|
303
294
|
if (helperResult instanceof Promise) {
|
|
304
|
-
// Handle async ESM loading
|
|
295
|
+
// Handle async ESM loading - create placeholder
|
|
305
296
|
helpers[helperName] = {}
|
|
306
297
|
asyncHelperPromise = asyncHelperPromise
|
|
307
298
|
.then(() => helperResult)
|
|
@@ -320,8 +311,7 @@ async function createHelpers(config) {
|
|
|
320
311
|
|
|
321
312
|
checkHelperRequirements(ResolvedHelperClass)
|
|
322
313
|
helpers[helperName] = new ResolvedHelperClass(config[helperName])
|
|
323
|
-
|
|
324
|
-
debug(`helper ${helperName} async initialized`)
|
|
314
|
+
debug(`helper ${helperName} async loaded`)
|
|
325
315
|
})
|
|
326
316
|
continue
|
|
327
317
|
} else {
|
|
@@ -341,9 +331,8 @@ async function createHelpers(config) {
|
|
|
341
331
|
throw new Error(`Helper class from module '${helperName}' is not a class. Use CJS async module syntax.`)
|
|
342
332
|
}
|
|
343
333
|
|
|
344
|
-
debug(`helper ${helperName} async initialized`)
|
|
345
|
-
|
|
346
334
|
helpers[helperName] = new ResolvedHelperClass(config[helperName])
|
|
335
|
+
debug(`helper ${helperName} async CJS loaded`)
|
|
347
336
|
})
|
|
348
337
|
|
|
349
338
|
continue
|
|
@@ -358,19 +347,17 @@ async function createHelpers(config) {
|
|
|
358
347
|
}
|
|
359
348
|
}
|
|
360
349
|
|
|
361
|
-
//
|
|
362
|
-
for (const name in helpers) {
|
|
363
|
-
if (helpers[name] && typeof helpers[name] === 'object') {
|
|
364
|
-
helpers[name].helpers = helpers
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
// Wait for async helpers and call _init
|
|
350
|
+
// Wait for all async helpers to be fully loaded
|
|
369
351
|
await asyncHelperPromise
|
|
370
352
|
|
|
353
|
+
// Call _init on all helpers after they're all loaded
|
|
371
354
|
for (const name in helpers) {
|
|
372
|
-
if (helpers[name]._init)
|
|
355
|
+
if (helpers[name]._init) {
|
|
356
|
+
await helpers[name]._init()
|
|
357
|
+
debug(`helper ${name} _init() called`)
|
|
358
|
+
}
|
|
373
359
|
}
|
|
360
|
+
|
|
374
361
|
return helpers
|
|
375
362
|
}
|
|
376
363
|
|
package/lib/helper/REST.js
CHANGED
|
@@ -468,7 +468,8 @@ class REST extends Helper {
|
|
|
468
468
|
export { REST as default }
|
|
469
469
|
|
|
470
470
|
function curlize(request) {
|
|
471
|
-
|
|
471
|
+
// Guard access to nested properties safely in case request.data is undefined
|
|
472
|
+
if ((request.data?.constructor?.name || '').toLowerCase() === 'formdata') return 'cURL is not printed as the request body is not a JSON'
|
|
472
473
|
let curl = `curl --location --request ${request.method ? request.method.toUpperCase() : 'GET'} ${request.baseURL} `.replace("'", '')
|
|
473
474
|
|
|
474
475
|
if (request.headers) {
|