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:
- Custom file include patterns
- Path-based test ID prefixes
- Preferred props for ID generation
- 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;
}
Description
The current
ConfigurationSchemainterface does not support several useful configuration options that users commonly need:include: File patterns to includeoptions.usePathAsPrefix: Use file path as test ID prefixoptions.prefixSeparator: Custom separator for prefixoptions.removeExtension: Remove file extension from path prefixoptions.overwrite: Overwrite existing test IDsoptions.preferProps: Preferred props to use for ID generationrules.includeElements: HTML elements to includerules.includeComponents: React components to includebackup: Create backup filesCurrent 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, andrulesfields are ignored because they are not defined in theConfigurationSchemainterface.Expected Behavior
The configuration schema should support these options to allow:
Proposed Solution
Extend the
ConfigurationSchemainterface to include: