testing-library/eslint-plugin-testing-library

Failure to detect `no-wait-for-side-effects` when used in conjunction with `await`

BenGane opened this issue · 2 comments

Have you read the Troubleshooting section?

Yes

Plugin version

v5.10.2

ESLint version

v8.13.0

Node.js version

18.13.0

package manager and version

npm 8.19.3

Operating system

Windows Version 10.0.19044 Build 19044

Bug description

When writing Vue tests, I get no warning when I use side effects within with waitFor call-back if I await them.

Steps to reproduce

// Component.spec.tsx
import { screen, fireEvent, waitFor } from "@testing-library/vue";

it("some test", async () => {
  await waitFor(async () => {
    // I expect the warning 'Avoid using side effects within `waitFor` callback'
    await fireEvent.click(screen.getByTestId("something"));
  });
});

Error output/screenshots

No response

ESLint configuration

/* eslint-env node */
require("@rushstack/eslint-patch/modern-module-resolution");

module.exports = {
  root: true,
  plugins: ["vitest"],
  extends: [
    "plugin:vue/vue3-essential",
    "eslint:recommended",
    "plugin:jest-formatting/recommended",
    "@vue/eslint-config-typescript/recommended",
    "@vue/eslint-config-prettier",
    "plugin:testing-library/vue",
  ],
  env: {
    "vue/setup-compiler-macros": false,
  },
  rules: {
    eqeqeq: ["warn", "always"],
    "vitest/no-conditional-tests": "warn",
    "vitest/no-focused-tests": "warn",
    "vitest/no-identical-title": "warn",
    "vitest/no-skipped-tests": "warn",
    "require-await": "warn",
  },
  overrides: [
    {
      files: ["cypress/integration/**.spec.{js,ts,jsx,tsx}"],
      extends: ["plugin:cypress/recommended"],
    },
  ],
};

Rule(s) affected

no-wait-for-side-effects

Anything else?

No response

Do you want to submit a pull request to fix this bug?

No

Thanks for reporting @BenGane