plugins.js 1.4 KB

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