index.d.mts 1.5 KB

1234567891011121314151617181920212223242526272829
  1. import { StackData } from "stack-utils";
  2. import { Config, TestResult } from "@jest/types";
  3. //#region src/types.d.ts
  4. interface Frame extends StackData {
  5. file: string;
  6. }
  7. //#endregion
  8. //#region src/index.d.ts
  9. type StackTraceConfig = Pick<Config.ProjectConfig, 'rootDir' | 'testMatch'>;
  10. type StackTraceOptions = {
  11. noStackTrace: boolean;
  12. noCodeFrame?: boolean;
  13. };
  14. declare const indentAllLines: (lines: string) => string;
  15. declare const formatExecError: (error: Error | TestResult.SerializableError | string | number | undefined, config: StackTraceConfig, options: StackTraceOptions, testPath?: string, reuseMessage?: boolean, noTitle?: boolean) => string;
  16. declare const formatPath: (line: string, config: StackTraceConfig, relativeTestPath?: string | null) => string;
  17. declare function getStackTraceLines(stack: string, options?: StackTraceOptions): Array<string>;
  18. declare function getTopFrame(lines: Array<string>): Frame | null;
  19. declare function formatStackTrace(stack: string, config: StackTraceConfig, options: StackTraceOptions, testPath?: string): string;
  20. declare const formatResultsErrors: (testResults: Array<TestResult.AssertionResult>, config: StackTraceConfig, options: StackTraceOptions, testPath?: string) => string | null;
  21. declare const separateMessageFromStack: (content: string) => {
  22. message: string;
  23. stack: string;
  24. };
  25. //#endregion
  26. export { Frame, StackTraceConfig, StackTraceOptions, formatExecError, formatPath, formatResultsErrors, formatStackTrace, getStackTraceLines, getTopFrame, indentAllLines, separateMessageFromStack };