utils.d.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. import { Config } from '@jest/types';
  8. declare type ResolveOptions = {
  9. rootDir: Config.Path;
  10. key: string;
  11. filePath: Config.Path;
  12. optional?: boolean;
  13. };
  14. export declare const BULLET: string;
  15. export declare const DOCUMENTATION_NOTE: string;
  16. export declare const resolve: (resolver: string | null | undefined, { key, filePath, rootDir, optional }: ResolveOptions) => string;
  17. export declare const escapeGlobCharacters: (path: string) => string;
  18. export declare const replaceRootDirInPath: (rootDir: string, filePath: string) => string;
  19. declare type OrArray<T> = T | Array<T>;
  20. declare type ReplaceRootDirConfigObj = Record<string, Config.Path>;
  21. declare type ReplaceRootDirConfigValues = OrArray<ReplaceRootDirConfigObj> | OrArray<RegExp> | OrArray<Config.Path>;
  22. export declare const _replaceRootDirTags: <T extends ReplaceRootDirConfigValues>(rootDir: string, config: T) => T;
  23. export declare const resolveWithPrefix: (resolver: string | null | undefined, { filePath, humanOptionName, optionName, prefix, rootDir, }: {
  24. filePath: string;
  25. humanOptionName: string;
  26. optionName: string;
  27. prefix: string;
  28. rootDir: string;
  29. }) => string;
  30. /**
  31. * Finds the test environment to use:
  32. *
  33. * 1. looks for jest-environment-<name> relative to project.
  34. * 1. looks for jest-environment-<name> relative to Jest.
  35. * 1. looks for <name> relative to project.
  36. * 1. looks for <name> relative to Jest.
  37. */
  38. export declare const getTestEnvironment: ({ rootDir, testEnvironment: filePath, }: {
  39. rootDir: string;
  40. testEnvironment: string;
  41. }) => string;
  42. /**
  43. * Finds the watch plugins to use:
  44. *
  45. * 1. looks for jest-watch-<name> relative to project.
  46. * 1. looks for jest-watch-<name> relative to Jest.
  47. * 1. looks for <name> relative to project.
  48. * 1. looks for <name> relative to Jest.
  49. */
  50. export declare const getWatchPlugin: (resolver: string | null | undefined, { filePath, rootDir }: {
  51. filePath: string;
  52. rootDir: string;
  53. }) => string;
  54. /**
  55. * Finds the runner to use:
  56. *
  57. * 1. looks for jest-runner-<name> relative to project.
  58. * 1. looks for jest-runner-<name> relative to Jest.
  59. * 1. looks for <name> relative to project.
  60. * 1. looks for <name> relative to Jest.
  61. */
  62. export declare const getRunner: (resolver: string | null | undefined, { filePath, rootDir }: {
  63. filePath: string;
  64. rootDir: string;
  65. }) => string;
  66. declare type JSONString = string & {
  67. readonly $$type: never;
  68. };
  69. export declare const isJSONString: (text?: string | JSONString | undefined) => text is JSONString;
  70. export declare const getSequencer: (resolver: string | null | undefined, { filePath, rootDir }: {
  71. filePath: string;
  72. rootDir: string;
  73. }) => string;
  74. export {};
  75. //# sourceMappingURL=utils.d.ts.map