+++ /dev/null
-import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '../ts-estree';\r
-import { ParserOptions } from './ParserOptions';\r
-import { RuleModule } from './Rule';\r
-interface ValidTestCase<TOptions extends Readonly<unknown[]>> {\r
- /**\r
- * Code for the test case.\r
- */\r
- readonly code: string;\r
- /**\r
- * Environments for the test case.\r
- */\r
- readonly env?: Readonly<Record<string, boolean>>;\r
- /**\r
- * The fake filename for the test case. Useful for rules that make assertion about filenames.\r
- */\r
- readonly filename?: string;\r
- /**\r
- * The additional global variables.\r
- */\r
- readonly globals?: Record<string, 'readonly' | 'writable' | 'off'>;\r
- /**\r
- * Options for the test case.\r
- */\r
- readonly options?: Readonly<TOptions>;\r
- /**\r
- * The absolute path for the parser.\r
- */\r
- readonly parser?: string;\r
- /**\r
- * Options for the parser.\r
- */\r
- readonly parserOptions?: Readonly<ParserOptions>;\r
- /**\r
- * Settings for the test case.\r
- */\r
- readonly settings?: Readonly<Record<string, unknown>>;\r
-}\r
-interface SuggestionOutput<TMessageIds extends string> {\r
- /**\r
- * Reported message ID.\r
- */\r
- readonly messageId: TMessageIds;\r
- /**\r
- * The data used to fill the message template.\r
- */\r
- readonly data?: Readonly<Record<string, unknown>>;\r
- /**\r
- * NOTE: Suggestions will be applied as a stand-alone change, without triggering multi-pass fixes.\r
- * Each individual error has its own suggestion, so you have to show the correct, _isolated_ output for each suggestion.\r
- */\r
- readonly output: string;\r
-}\r
-interface InvalidTestCase<TMessageIds extends string, TOptions extends Readonly<unknown[]>> extends ValidTestCase<TOptions> {\r
- /**\r
- * Expected errors.\r
- */\r
- readonly errors: TestCaseError<TMessageIds>[];\r
- /**\r
- * The expected code after autofixes are applied. If set to `null`, the test runner will assert that no autofix is suggested.\r
- */\r
- readonly output?: string | null;\r
-}\r
-interface TestCaseError<TMessageIds extends string> {\r
- /**\r
- * The 1-based column number of the reported start location.\r
- */\r
- readonly column?: number;\r
- /**\r
- * The data used to fill the message template.\r
- */\r
- readonly data?: Readonly<Record<string, unknown>>;\r
- /**\r
- * The 1-based column number of the reported end location.\r
- */\r
- readonly endColumn?: number;\r
- /**\r
- * The 1-based line number of the reported end location.\r
- */\r
- readonly endLine?: number;\r
- /**\r
- * The 1-based line number of the reported start location.\r
- */\r
- readonly line?: number;\r
- /**\r
- * Reported message ID.\r
- */\r
- readonly messageId: TMessageIds;\r
- /**\r
- * Reported suggestions.\r
- */\r
- readonly suggestions?: SuggestionOutput<TMessageIds>[] | null;\r
- /**\r
- * The type of the reported AST node.\r
- */\r
- readonly type?: AST_NODE_TYPES | AST_TOKEN_TYPES;\r
-}\r
-interface RunTests<TMessageIds extends string, TOptions extends Readonly<unknown[]>> {\r
- readonly valid: (ValidTestCase<TOptions> | string)[];\r
- readonly invalid: InvalidTestCase<TMessageIds, TOptions>[];\r
-}\r
-interface RuleTesterConfig {\r
- readonly parser: string;\r
- readonly parserOptions?: Readonly<ParserOptions>;\r
-}\r
-declare class RuleTesterBase {\r
- /**\r
- * Creates a new instance of RuleTester.\r
- * @param testerConfig extra configuration for the tester\r
- */\r
- constructor(testerConfig?: RuleTesterConfig);\r
- /**\r
- * Adds a new rule test to execute.\r
- * @param ruleName The name of the rule to run.\r
- * @param rule The rule to test.\r
- * @param test The collection of tests to run.\r
- */\r
- run<TMessageIds extends string, TOptions extends Readonly<unknown[]>>(ruleName: string, rule: RuleModule<TMessageIds, TOptions>, tests: RunTests<TMessageIds, TOptions>): void;\r
- /**\r
- * If you supply a value to this property, the rule tester will call this instead of using the version defined on\r
- * the global namespace.\r
- * @param text a string describing the rule\r
- * @param callback the test callback\r
- */\r
- static describe?: (text: string, callback: () => void) => void;\r
- /**\r
- * If you supply a value to this property, the rule tester will call this instead of using the version defined on\r
- * the global namespace.\r
- * @param text a string describing the test case\r
- * @param callback the test callback\r
- */\r
- static it?: (text: string, callback: () => void) => void;\r
-}\r
-declare const RuleTester_base: typeof RuleTesterBase;\r
-declare class RuleTester extends RuleTester_base {\r
-}\r
-export { InvalidTestCase, SuggestionOutput, RuleTester, RuleTesterConfig, RunTests, TestCaseError, ValidTestCase, };\r
-//# sourceMappingURL=RuleTester.d.ts.map\r