plugins.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.getSerializers = exports.addSerializer = void 0;
  6. var _prettyFormat = _interopRequireDefault(require('pretty-format'));
  7. var _mockSerializer = _interopRequireDefault(require('./mockSerializer'));
  8. function _interopRequireDefault(obj) {
  9. return obj && obj.__esModule ? obj : {default: obj};
  10. }
  11. /**
  12. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  13. *
  14. * This source code is licensed under the MIT license found in the
  15. * LICENSE file in the root directory of this source tree.
  16. */
  17. const {
  18. DOMCollection,
  19. DOMElement,
  20. Immutable,
  21. ReactElement,
  22. ReactTestComponent,
  23. AsymmetricMatcher
  24. } = _prettyFormat.default.plugins;
  25. let PLUGINS = [
  26. ReactTestComponent,
  27. ReactElement,
  28. DOMElement,
  29. DOMCollection,
  30. Immutable,
  31. _mockSerializer.default,
  32. AsymmetricMatcher
  33. ]; // Prepend to list so the last added is the first tested.
  34. const addSerializer = plugin => {
  35. PLUGINS = [plugin].concat(PLUGINS);
  36. };
  37. exports.addSerializer = addSerializer;
  38. const getSerializers = () => PLUGINS;
  39. exports.getSerializers = getSerializers;