Skip to content

linter: vitest/max-nested-describe don't reset with nested sibilings #21888

Description

@Mister-Hope

What version of Oxlint are you using?

latest

What happened?

linter: vitest/max-nested-describe don't reset with nested sibilings.

Basically, https://oxc.rs/docs/guide/usage/linter/rules/vitest/max-nested-describe.html gives a correctness result:

describe("foo", () => {
  describe("bar", () => {
    it("should get something", () => {
      expect(getSomething()).toBe("Something");
    });
  });
  describe("qux", () => {
    it("should get something", () => {
      expect(getSomething()).toBe("Something");
    });
  });
});

describe("foo2", function () {
  it("should get something", () => {
    expect(getSomething()).toBe("Something");
  });
});

describe("foo", function () {
  describe("bar", function () {
    describe("baz", function () {
      describe("qux", function () {
        describe("this is the limit", function () {
          it("should get something", () => {
            expect(getSomething()).toBe("Something");
          });
        });
      });
    });
  });
});

While the result itselfs is now failing:

Image

This is because though first foo ends, but the rule still regard this as a parent for foo2, and foo2 the parent of the second foo.

For me I am maintaining a markdown-it repo containing 1525 test cases, and it produces tons of noise after upgrading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions