From 53e4c0ac0ee3c37c5f42d5ea19e867814abb8050 Mon Sep 17 00:00:00 2001 From: Dan Abramov <dan.abramov@gmail.com> Date: Mon, 1 Oct 2018 14:50:23 +0100 Subject: [PATCH] Format SVG React snapshots as <svg> tag with props (#5196) * Format SVG React snapshots as <svg> tag with props * Keep output simpler --- packages/react-scripts/config/jest/fileTransform.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/react-scripts/config/jest/fileTransform.js b/packages/react-scripts/config/jest/fileTransform.js index b5aa17e0f..f442f0bbd 100644 --- a/packages/react-scripts/config/jest/fileTransform.js +++ b/packages/react-scripts/config/jest/fileTransform.js @@ -21,7 +21,15 @@ module.exports = { return `module.exports = { __esModule: true, default: ${assetFilename}, - ReactComponent: () => ${assetFilename}, + ReactComponent: (props) => ({ + $$typeof: Symbol.for('react.element'), + type: 'svg', + ref: null, + key: null, + props: Object.assign({}, props, { + children: ${assetFilename} + }) + }), };`; } -- GitLab