State.d.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. export declare type SnapshotStateOptions = {
  9. updateSnapshot: Config.SnapshotUpdateState;
  10. getPrettier: () => null | any;
  11. getBabelTraverse: () => Function;
  12. expand?: boolean;
  13. };
  14. export declare type SnapshotMatchOptions = {
  15. testName: string;
  16. received: any;
  17. key?: string;
  18. inlineSnapshot?: string;
  19. error?: Error;
  20. };
  21. export default class SnapshotState {
  22. private _counters;
  23. private _dirty;
  24. private _index;
  25. private _updateSnapshot;
  26. private _snapshotData;
  27. private _initialData;
  28. private _snapshotPath;
  29. private _inlineSnapshots;
  30. private _uncheckedKeys;
  31. private _getBabelTraverse;
  32. private _getPrettier;
  33. added: number;
  34. expand: boolean;
  35. matched: number;
  36. unmatched: number;
  37. updated: number;
  38. constructor(snapshotPath: Config.Path, options: SnapshotStateOptions);
  39. markSnapshotsAsCheckedForTest(testName: string): void;
  40. private _addSnapshot;
  41. clear(): void;
  42. save(): {
  43. deleted: boolean;
  44. saved: boolean;
  45. };
  46. getUncheckedCount(): number;
  47. getUncheckedKeys(): Array<string>;
  48. removeUncheckedKeys(): void;
  49. match({ testName, received, key, inlineSnapshot, error, }: SnapshotMatchOptions): {
  50. actual: string;
  51. count: number;
  52. expected: string | null;
  53. key: string;
  54. pass: boolean;
  55. };
  56. fail(testName: string, _received: any, key?: string): string;
  57. }
  58. //# sourceMappingURL=State.d.ts.map