Skip to content

expect.hasAssertion and expect.assertions pollute other assertions tests #6540

Closed
@WWRS

Description

@WWRS

Describe the bug

If one expect.hasAssertion or expect.assertions test fails, others may be affected.

Steps to Reproduce

Only the first test should fail, but the second also fails: the assertion from the first test leaked into the second.

test("failing test", () => {
  expect.assertions(0);
  expect(1).toEqual(1);
});

test("expect no assertions", () => {
  expect.assertions(0);
});

Expected behavior

Assertions tests should not interact across testing contexts

Environment

  • OS: Win11
  • deno version: 2.2.5
  • std version: latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions