Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
BenGane opened this issue Mar 30, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@BenGane
Copy link

BenGane commented Mar 30, 2023

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

@BenGane BenGane added bug Something isn't working triage Pending to be triaged by a maintainer labels Mar 30, 2023
@Belco90 Belco90 removed the triage Pending to be triaged by a maintainer label Apr 9, 2023
@Belco90
Copy link
Member

Belco90 commented Apr 9, 2023

Thanks for reporting @BenGane

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants