Jest snapshot class names with CSS Modules are only shown as undefined, this PR will change those to be shown as their actual class names using the identity-obj-proxy package.
In the sample app creating the following snapshot test
import React from 'react';
import ReactDOM from 'react-dom';
import renderer from 'react-test-renderer';
import App from './App';
it('renders a snapshot', () => {
const tree = renderer.create(<App />).toJSON();
expect(tree).toMatchSnapshot();
});
would format the element <div className={cssStyles.header}> in App.js as <div className={undefined}>, after this fix it will be <div className="header">.
Closes #106
This PR will also add CSS Module class name template (localIdentName) as an ENV configuration option as REACT_APP_CSS_MODULE_CLASSNAME_TEMPLATE. If not provided the style-loader.js will use the default template [sha512:hash:base32]-[name]-[local].
Closes #97
Jest snapshot class names with CSS Modules are only shown as
undefined
, this PR will change those to be shown as their actual class names using theidentity-obj-proxy
package. In the sample app creating the following snapshot testwould format the element
<div className={cssStyles.header}>
in App.js as<div className={undefined}>
, after this fix it will be<div className="header">
. Closes #106This PR will also add CSS Module class name template (localIdentName) as an ENV configuration option as
REACT_APP_CSS_MODULE_CLASSNAME_TEMPLATE
. If not provided the style-loader.js will use the default template[sha512:hash:base32]-[name]-[local]
. Closes #97