Skip to content

ConfigurationSchema does not support custom configuration options (include, options, rules) #3

Description

@jiyhong

Description

The current ConfigurationSchema interface does not support several useful configuration options that users commonly need:

  • include: File patterns to include
  • options.usePathAsPrefix: Use file path as test ID prefix
  • options.prefixSeparator: Custom separator for prefix
  • options.removeExtension: Remove file extension from path prefix
  • options.overwrite: Overwrite existing test IDs
  • options.preferProps: Preferred props to use for ID generation
  • rules.includeElements: HTML elements to include
  • rules.includeComponents: React components to include
  • backup: Create backup files

Current Behavior

When using a config file like:

{
  "frameworks": ["react"],
  "attributeName": "data-qa",
  "naming": "kebab-case",
  "include": ["pages/**/*.{tsx,jsx}"],
  "options": {
    "usePathAsPrefix": true,
    "preferProps": ["id", "name", "key", "label", "title"]
  },
  "rules": {
    "includeElements": ["button", "input", "a", "select", "textarea"],
    "includeComponents": ["Button", "ProFormText", "ProTable"]
  }
}

The include, options, and rules fields are ignored because they are not defined in the ConfigurationSchema interface.

Expected Behavior

The configuration schema should support these options to allow:

  1. Custom file include patterns
  2. Path-based test ID prefixes
  3. Preferred props for ID generation
  4. Component-specific filtering

Proposed Solution

Extend the ConfigurationSchema interface to include:

export interface GenerationOptions {
  usePathAsPrefix?: boolean;
  prefixSeparator?: string;
  removeExtension?: boolean;
  overwrite?: boolean;
  preferProps?: string[];
}

export interface ElementRules {
  includeElements?: string[];
  includeComponents?: string[];
}

export interface ConfigurationSchema {
  // ... existing fields
  include?: string[];
  options?: GenerationOptions;
  rules?: ElementRules;
  backup?: boolean;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions