plugins.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 _mock_serializer = _interopRequireDefault(require('./mock_serializer'));
  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 _prettyFormat$plugins = _prettyFormat.default.plugins,
  18. DOMCollection = _prettyFormat$plugins.DOMCollection,
  19. DOMElement = _prettyFormat$plugins.DOMElement,
  20. Immutable = _prettyFormat$plugins.Immutable,
  21. ReactElement = _prettyFormat$plugins.ReactElement,
  22. ReactTestComponent = _prettyFormat$plugins.ReactTestComponent,
  23. AsymmetricMatcher = _prettyFormat$plugins.AsymmetricMatcher;
  24. let PLUGINS = [
  25. ReactTestComponent,
  26. ReactElement,
  27. DOMElement,
  28. DOMCollection,
  29. Immutable,
  30. _mock_serializer.default,
  31. AsymmetricMatcher
  32. ]; // Prepend to list so the last added is the first tested.
  33. const addSerializer = plugin => {
  34. PLUGINS = [plugin].concat(PLUGINS);
  35. };
  36. exports.addSerializer = addSerializer;
  37. const getSerializers = () => PLUGINS;
  38. exports.getSerializers = getSerializers;