import { ComponentDoc } from 'react-docgen-typescript'; import * as React_2 from 'react'; import { render } from '@testing-library/react'; import * as ts from 'typescript'; export declare type BaseConformanceTest = (testInfo: IsConformantOptions) => void; export declare type ConformanceTest = (testInfo: IsConformantOptions, componentInfo: ComponentDoc, tsProgram: ts.Program) => void; export declare function isConformant(...testInfo: Partial>[]): void; export declare interface IsConformantOptions { /** * Path to component file. */ componentPath: string; /** * Component object to test. */ Component: React_2.ComponentType; /** * Display name that will be considered as the correct displayName. */ displayName: string; /** * Custom options passed to `@testing-library/react`'s `render` method. */ renderOptions?: Parameters[1]; /** * If there are tests that aren't supposed to run on a component, this allows to opt out of any test. */ disabledTests?: string[]; /** * Disable tests that verify the component's prop types. * These tests require TypeScript information. * It is recommended to keep these tests enabled, but they can be disabled in a large repo to improve test performance and memory consumption. */ disableTypeTests?: boolean; /** * Optional flag that means the component is not exported at top level. * @defaultvalue false */ isInternal?: boolean; /** * Additional tests to run. */ extraTests?: TestObject; /** * If the component has required props, they can be added in this object and will be applied when mounting/rendering. */ requiredProps?: Partial; /** * Optional flag to use the default export. * @defaultvalue false */ useDefaultExport?: boolean; /** * Allows specific test options. */ testOptions?: TestOptions; /** * An alternative name for the ref prop which resolves to * the root element (e.g. `elementRef`). * @defaultvalue 'ref' */ elementRefName?: string; /** * Get the element that will receive native props (or the specified native prop, if it matters) */ getTargetElement?: (renderResult: ReturnType, attr: keyof React_2.AllHTMLAttributes | 'ref' | `data-${string}`) => HTMLElement; /** * The name of the slot designated as "primary", which receives native props passed to the component. * This is 'root' by default, and only needs to be specified if it's a slot other than 'root'. */ primarySlot?: keyof TProps | 'root'; /** * @deprecated - use `tsConfig` property * * Test will load the first tsconfig.json file working upwards from `tsconfigDir`. * @defaultvalue the directory of the component being tested */ tsconfigDir?: string; /** * replaces tsconfigDir */ tsConfig?: Partial<{ configName: string; configDir: string; }>; } export declare interface TestObject { [key: string]: BaseConformanceTest | ConformanceTest; } /** * Individual test options */ export declare interface TestOptions { 'consistent-callback-names'?: { ignoreProps?: string[]; }; 'consistent-callback-args'?: { legacyCallbacks?: string[]; }; 'has-static-classnames'?: { props: { [key: string]: string | {}; }; expectedClassNames?: { [key: string]: string; }; getPortalElement?: (renderResult: ReturnType) => HTMLElement; }[]; 'component-has-static-classname'?: { /** Prefix for the classname, if not `fui-` */ prefix?: string; }; } export { }