plugins.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.getSerializers = exports.addSerializer = void 0;
  6. var _prettyFormat = 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) Meta Platforms, Inc. and affiliates.
  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.plugins;
  25. let PLUGINS = [
  26. ReactTestComponent,
  27. ReactElement,
  28. DOMElement,
  29. DOMCollection,
  30. Immutable,
  31. _mockSerializer.default,
  32. AsymmetricMatcher
  33. ];
  34. // Prepend to list so the last added is the first tested.
  35. const addSerializer = plugin => {
  36. PLUGINS = [plugin].concat(PLUGINS);
  37. };
  38. exports.addSerializer = addSerializer;
  39. const getSerializers = () => PLUGINS;
  40. exports.getSerializers = getSerializers;