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
I've just spent an hour or so scratching my head why aren't my tests working when I just added an empty beforeScenario hook function in my test, until I found another example where those functions receive the 3rd argument next and I need to call it to let the scenario continue.
beforeRequest and afterResponse doc seems to have the same problem.
The text was updated successfully, but these errors were encountered:
thanks for taking the time to open an issue @peterhalicky! We need to make it clearer in the docs that functions have to be async. It's tucked away elsewhere in the docs at the moment and is not easy to find.
OK, looks like it's more complicated than I initially thought. Documentation says that hooks can be async. Installing @types/artillery brings in the type definitions, but those say that the hooks are supposed to return void -- but async functions will return Promise<void> which isn't the same thing, so you get a warning in the IDE and also artillery (nodejs) complains ("DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.").
In fact, as I just found, if a function is async, the next() call isn't needed -- but I still get those deprecation warnings above.
Documentation about function and beforeScenario/afterScenario hooks of the HTTP engine states that the hooks receive two parameters -
context
andevents
. Also some examples only specify those two.I've just spent an hour or so scratching my head why aren't my tests working when I just added an empty
beforeScenario
hook function in my test, until I found another example where those functions receive the 3rd argumentnext
and I need to call it to let the scenario continue.beforeRequest
andafterResponse
doc seems to have the same problem.The text was updated successfully, but these errors were encountered: