Skip to content

Rule to enforce a test has tags #401

@seanlafferty-ibm

Description

@seanlafferty-ibm

We currently use tags as a way to control what environment a test gets ran in, so we require all tests have tags. However, I don't believe this is enforceable by a lint rule.

I can config the tag rule like:

"playwright/valid-test-tags": [
  "error",
  { allowedTags: ["@saas", "@onprem"] },
],

but that still permits a test like test("Im a test with no tags"). Any thoughts about this? Perhaps a allowTestsWithoutTags bool option for this rule?

I suppose there could be some nuance in that a test() inherits the tags of its parent describe() block, so if this rule did exist, we'd have to decide if we want do the recursion to make

describe("parent @tag1")
  test("child")

permissable, or just have the rule operate naively on test() calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions