Skip to content

[expect-expect] allow additionalTestBlockFunctions to take a regex #993

Open
@NickBolles

Description

@NickBolles

I would like to do something like this

  "jest/expect-expect": [
    "error",
    {
        assertFunctionNames: ['expect', 'expect*', 'assert*'],
        additionalTestBlockFunctions: ['expect*', 'assert*']
    }
  ]

So that I can modularize assertion functions but still get the expect-expect checking on it. Seems like this would be easy to do by duplicating what assertionFunctionNames is doing

matchesAssertFunctionName

https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/expect-expect.ts#L25

and using it here:

https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/expect-expect.ts#L118

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