Skip to content

Repo: duplicated test cases in RuleTester.test.ts #11285

Closed
@nayounsang

Description

@nayounsang

Before You File a Proposal Please Confirm You Have Done The Following...

Relevant Package

rule-tester

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

// packages/rule-tester/tests/RuleTester.test.ts
    it('passes with no output', () => {
      expect(() => {
        ruleTester.run('my-rule', rule, {
          invalid: [
            {
              code: 'foo',
              errors: [{ messageId: 'error' }],
            },
          ],
          valid: [],
        });
      }).not.toThrow();
    });

    it('passes with null output', () => {
      expect(() => {
        ruleTester.run('my-rule', rule, {
          invalid: [
            {
              code: 'foo',
              errors: [{ messageId: 'error' }],
            },
          ],
          valid: [],
        });
      }).not.toThrow();
    });

These two test cases have almost the same meaning and are written in exactly the same code.

  1. Remove duplicates
    OR
  2. If duplication is absolutely necessary, please state in a comment why it is necessary.
    OR
  3. write it clearly.
    it('passes with null output', () => {
      expect(() => {
        ruleTester.run('my-rule', rule, {
          invalid: [
            {
              code: 'foo',
              errors: [{ messageId: 'error' }],
              output: null,
            },
          ],
          valid: [],
        });
      }).not.toThrow();
    });

Additional Info


Is this an issue with repo maintainance?

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuerepo maintenancethings to do with maintenance of the repo, and not with code/docs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy