Skip to content

group.each.setup and group.each.teardown not working #4609

Discussion options

You must be logged in to vote

I've found the solution.

  group.each.setup(async () => {
    const func = await testUtils.db().truncate()
    await func()
  })

If you do console.log(func) you will get [Function (anonymous)]. And if you console.log(func()) you will get Promise { <pending> } so it makes sense to await but it also works with only func().

However it does not work without async because func is a promise.

@RomainLanz this does not seem like how it should work. If you point me to the right direction I can check the source code for this and check why it is behaving like this and/or change the docs.

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@backspacerhino
Comment options

Comment options

You must be logged in to vote
2 replies
@eduwass
Comment options

@eduwass
Comment options

Answer selected by backspacerhino
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Japa
Labels
None yet
4 participants