Skip to content

Feature request: pass test additional arguments to beforeEach function #2070

Closed
@pwalczyszyn

Description

@pwalczyszyn

Issuehunt badges

Would be cool if we had access in beforeEach hook to additional arguments that can be passed to each test. Kinda like it's demonstrated in macros docs. This would allow beforeEach hook parametrisation. Like in the example below:

test.beforeEach(async (t, args) => {
  if (args.initDb) {
    // initialise db
  }
});

test('my test with args', async t => {

}, {
  initDb: true
});

There is a $40.00 open bounty on this issue. Add more on Issuehunt.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions