Skip to content

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

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

Open
4 tasks done
nayounsang opened this issue Jun 8, 2025 · 0 comments
Open
4 tasks done

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

nayounsang opened this issue Jun 8, 2025 · 0 comments
Labels
enhancement New feature or request triage Waiting for team members to take a look

Comments

@nayounsang
Copy link

nayounsang commented Jun 8, 2025

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?

@nayounsang nayounsang added enhancement New feature or request triage Waiting for team members to take a look labels Jun 8, 2025
@nayounsang nayounsang changed the title Enhancement: duplicated test cases Enhancement: duplicated test cases in RuleTester.test.ts Jun 8, 2025
@nayounsang nayounsang reopened this Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage Waiting for team members to take a look
Projects
None yet
Development

No branches or pull requests

1 participant
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