index.d.ts 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. import { MatcherState } from 'expect';
  9. import { SnapshotResolver as JestSnapshotResolver } from './snapshot_resolver';
  10. import SnapshotState from './State';
  11. import * as utils from './utils';
  12. declare type Context = MatcherState & {
  13. snapshotState: SnapshotState;
  14. };
  15. declare const JestSnapshot: {
  16. EXTENSION: string;
  17. SnapshotState: typeof SnapshotState;
  18. addSerializer: (plugin: import("pretty-format/build/types").Plugin) => void;
  19. buildSnapshotResolver: (config: Config.ProjectConfig) => JestSnapshotResolver;
  20. cleanup: (hasteFS: import("jest-haste-map/build/HasteFS").default, update: Config.SnapshotUpdateState, snapshotResolver: JestSnapshotResolver, testPathIgnorePatterns?: string[] | undefined) => {
  21. filesRemoved: number;
  22. filesRemovedList: string[];
  23. };
  24. getSerializers: () => import("pretty-format/build/types").Plugin[];
  25. isSnapshotPath: (path: string) => boolean;
  26. toMatchInlineSnapshot: (this: Context, received: any, propertyMatchersOrInlineSnapshot?: any, inlineSnapshot?: string | undefined) => {
  27. message: () => string;
  28. name: string;
  29. pass: boolean;
  30. report: () => string;
  31. actual?: undefined;
  32. expected?: undefined;
  33. } | {
  34. message: () => string;
  35. pass: boolean;
  36. name?: undefined;
  37. report?: undefined;
  38. actual?: undefined;
  39. expected?: undefined;
  40. } | {
  41. actual: string;
  42. expected: string | null;
  43. message: () => string;
  44. name: string;
  45. pass: boolean;
  46. report: () => string;
  47. };
  48. toMatchSnapshot: (this: Context, received: any, propertyMatchers?: any, hint?: string | undefined) => {
  49. message: () => string;
  50. name: string;
  51. pass: boolean;
  52. report: () => string;
  53. actual?: undefined;
  54. expected?: undefined;
  55. } | {
  56. message: () => string;
  57. pass: boolean;
  58. name?: undefined;
  59. report?: undefined;
  60. actual?: undefined;
  61. expected?: undefined;
  62. } | {
  63. actual: string;
  64. expected: string | null;
  65. message: () => string;
  66. name: string;
  67. pass: boolean;
  68. report: () => string;
  69. };
  70. toThrowErrorMatchingInlineSnapshot: (this: Context, received: any, inlineSnapshot?: string | undefined, fromPromise?: boolean | undefined) => {
  71. message: () => string;
  72. name: string;
  73. pass: boolean;
  74. report: () => string;
  75. actual?: undefined;
  76. expected?: undefined;
  77. } | {
  78. message: () => string;
  79. pass: boolean;
  80. name?: undefined;
  81. report?: undefined;
  82. actual?: undefined;
  83. expected?: undefined;
  84. } | {
  85. actual: string;
  86. expected: string | null;
  87. message: () => string;
  88. name: string;
  89. pass: boolean;
  90. report: () => string;
  91. };
  92. toThrowErrorMatchingSnapshot: (this: Context, received: any, hint: string | undefined, fromPromise: boolean) => {
  93. message: () => string;
  94. name: string;
  95. pass: boolean;
  96. report: () => string;
  97. actual?: undefined;
  98. expected?: undefined;
  99. } | {
  100. message: () => string;
  101. pass: boolean;
  102. name?: undefined;
  103. report?: undefined;
  104. actual?: undefined;
  105. expected?: undefined;
  106. } | {
  107. actual: string;
  108. expected: string | null;
  109. message: () => string;
  110. name: string;
  111. pass: boolean;
  112. report: () => string;
  113. };
  114. utils: typeof utils;
  115. };
  116. declare namespace JestSnapshot {
  117. type SnapshotResolver = JestSnapshotResolver;
  118. type SnapshotStateType = SnapshotState;
  119. }
  120. export = JestSnapshot;
  121. //# sourceMappingURL=index.d.ts.map