Skip to content

--forbid-only does not error on suite marked only with no tests #2944

@ScottFreeCode

Description

@ScottFreeCode

Both before and after #2874, the --forbid functions are implemented in terms of tests, whereas only is quite aware of suites including empty ones; thus, the following file:

describe.only("nothing", function() {})
it("should fail", function() { throw new Error("Ouch!") })

...passes with 0 tests run instead of failing due to only being forbidden (or ignoring the empty onlyed suite and failing the other test).

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: accepting prsMocha can use your help with this one!type: buga defect, confirmed by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions