codeceptjs 4.0.1-beta.2 → 4.0.1-beta.4
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 +3 -0
- package/lib/listener/config.js +11 -3
- package/package.json +1 -1
package/lib/container.js
CHANGED
|
@@ -110,6 +110,9 @@ class Container {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
// Wait for all async helpers to finish loading and populate the actor with helper methods
|
|
114
|
+
await asyncHelperPromise
|
|
115
|
+
|
|
113
116
|
if (opts && opts.ai) ai.enable(config.ai) // enable AI Assistant
|
|
114
117
|
if (config.gherkin) await loadGherkinStepsAsync(config.gherkin.steps || [])
|
|
115
118
|
if (opts && typeof opts.timeouts === 'boolean') store.timeouts = opts.timeouts
|
package/lib/listener/config.js
CHANGED
|
@@ -12,15 +12,23 @@ export default function () {
|
|
|
12
12
|
return
|
|
13
13
|
}
|
|
14
14
|
global.__codeceptConfigListenerInitialized = true
|
|
15
|
-
|
|
16
|
-
const helpers = global.container.helpers()
|
|
17
15
|
|
|
18
16
|
enableDynamicConfigFor('suite')
|
|
19
17
|
enableDynamicConfigFor('test')
|
|
20
18
|
|
|
21
19
|
function enableDynamicConfigFor(type) {
|
|
22
20
|
event.dispatcher.on(event[type].before, (context = {}) => {
|
|
21
|
+
// Get helpers dynamically at runtime, not at initialization time
|
|
22
|
+
// This ensures we get the actual helper instances, not placeholders
|
|
23
|
+
const helpers = global.container.helpers()
|
|
24
|
+
|
|
23
25
|
function updateHelperConfig(helper, config) {
|
|
26
|
+
// Guard against undefined or invalid helpers
|
|
27
|
+
if (!helper || !helper.constructor) {
|
|
28
|
+
output.debug(`[${ucfirst(type)} Config] Helper not found or not properly initialized`)
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
|
|
24
32
|
const oldConfig = deepClone(helper.options)
|
|
25
33
|
try {
|
|
26
34
|
helper._setConfig(deepMerge(deepClone(oldConfig), config))
|
|
@@ -41,7 +49,7 @@ export default function () {
|
|
|
41
49
|
for (let name in context.config) {
|
|
42
50
|
const config = context.config[name]
|
|
43
51
|
if (name === '0') {
|
|
44
|
-
// first helper
|
|
52
|
+
// first helper - get dynamically
|
|
45
53
|
name = Object.keys(helpers)[0]
|
|
46
54
|
}
|
|
47
55
|
const helper = helpers[name]
|