diff --git a/README.md b/README.md index e8c498fe..17761ff1 100644 --- a/README.md +++ b/README.md @@ -272,6 +272,34 @@ module.exports = { } ``` + +#### Export Issue with Babel Versions Lower Than 7 + +Babel versions lower than 7 throw an error when trying to override the named export +in the example above. (See +[#169](https://github.com/kentcdodds/react-testing-library/issues/169).) + +
+Workaround + +You can use CommonJS modules instead of ES modules, which should work in Node: + +```js +// test-utils.js +const rtl = require('react-testing-library') + +const customRender = (node, ...options) => { + return rtl.render({node}) +} + +module.exports = { + ...rtl, + render: customRender, +} +``` + +
+ ## Usage ### `render`