Skip to content

Incorrect error message in non-awaited expect.element() calls #8953

@StyleShit

Description

@StyleShit

Describe the bug

When not awaiting an expect.element() call, there seem to be an issue with the error text. it shows the error for expect.poll:


(image taken from vitest-dev/eslint-plugin-vitest#683)

Reproduction

test("renders name", async () => {
  const element = page.getByText("Hello Vitest!");

  expect.element(element).toBeInTheDocument();
});

System Info

Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.21.1 - /Users/**/.local/state/fnm_multishells/15956_1762412239648/bin/node
    Yarn: 1.22.22 - /Users/**/.local/state/fnm_multishells/15956_1762412239648/bin/yarn
    npm: 10.9.4 - /Users/**/.local/state/fnm_multishells/15956_1762412239648/bin/npm
    pnpm: 10.20.0 - /Users/**/.local/state/fnm_multishells/15956_1762412239648/bin/pnpm
  Browsers:
    Chrome: 142.0.7444.60
    Firefox Developer Edition: 144.0
    Safari: 18.5
  npmPackages:
    @vitest/browser-playwright: ^4.0.7 => 4.0.7 
    vitest: ^4.0.7 => 4.0.7

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions