graphql-eslint icon indicating copy to clipboard operation
graphql-eslint copied to clipboard

rule function gets called twice for each invalid test case

Open shogunsea opened this issue 2 years ago • 0 comments

Issue workflow progress

Progress of the issue based on the Contributor Workflow

  • [ ] 1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox

Please make sure the graphql-eslint version under package.json matches yours.

  • [x] 2. A failing test has been provided
  • [ ] 3. A local solution has been provided
  • [ ] 4. A pull request is pending review

Describe the bug

the create function is called twice for each invalid test cases: 1 valid + 2 invalid = 1 + 2* 2 = 5 times logging

image

When I only keep 1 invalid test case: image

This does NOT happen in eslint or typescript-eslint rule test runner.

To Reproduce Steps to reproduce the behavior:

This can be easily reproduced by adding a console log like here: https://github.com/B2o5T/graphql-eslint/blob/7251269d9806202a1d9d6651a809a49396656978/packages/plugin/src/rules/no-unused-fields.ts#L105-L107 then run the spec:

yarn test packages/plugin/tests/no-unused-fields.spec.ts

Expected behavior

Environment:

  • OS: macOS
  • @graphql-eslint/eslint-plugin:
  • Node.js: 16.10

Additional context

shogunsea avatar Aug 24 '22 04:08 shogunsea