Skip to content

Repo: separate test cases with describe block in packages/eslint-plugin/tests/rules/no-unused-vars #11369

Open
@nayounsang

Description

@nayounsang

Suggestion

Problem

  • no-unused-vars-eslint.test.ts and no-unused-vars.test.ts has many lines & test case (over 3000 lines!).
  • As it is a complex and frequently used rule, the number of test cases increases over time.
  • Risk of writing duplicate test cases.
  • Possibility that test cases will be forgotten even if they are weird.
  • Difficulty knowing which test cases cover which code
  • Risk that these are test cases for related features but are far apart in the file

Solution

Separate test cases with describe block.
This is my opinion. In some cases, these are mixed.

order of describe layer description
1 messageId
2 action
additional option, test cases for weird bug, special syntax

Example

ex is just ex.

describe('unusedVar',() => {
  describe('defined action',()=>{
    describe('import statement',()=>{
       ruleTester.run('no-unused-vars', rule, {
       })
     })
  })
})

Additional Info

This is example of separated test cases: prefer-optional-chain

Metadata

Metadata

Assignees

No one assigned

    Labels

    repo maintenancethings to do with maintenance of the repo, and not with code/docstriageWaiting for team members to take a look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions