Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map (s?css|sass) modules to identity-obj-proxy in jest #4419

Merged
merged 1 commit into from
May 16, 2018

Conversation

kusold
Copy link
Contributor

@kusold kusold commented May 8, 2018

Fixes #4345

SCSS and SASS modules currently aren't getting transformed, instead they are being resolved by the fileTransform. This PR instead sends them through the identity-obj-proxy so that:

<div className={style.container>...</div>

becomes

<div className="container">...</div>

when using jest.

@@ -45,11 +45,11 @@ module.exports = (resolve, rootDir, srcRoots) => {
},
transformIgnorePatterns: [
'[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$',
'^.+\\.module\\.css$',
'^.+\\.module\\.(s?css|sass)$',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change this regular expression to (css|sass|scss)?

],
moduleNameMapper: {
'^react-native$': 'react-native-web',
'^.+\\.module\\.css$': 'identity-obj-proxy',
'^.+\\.module\\.(s?css|sass)$': 'identity-obj-proxy',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@kusold kusold force-pushed the style-modules-jest branch 2 times, most recently from e06834c to 93bdead Compare May 8, 2018 02:44
@Timer Timer added this to the 2.0.0 milestone May 8, 2018
@Timer
Copy link
Contributor

Timer commented May 8, 2018

We should land this with #4391.

@kusold
Copy link
Contributor Author

kusold commented May 8, 2018

What's the best way to force a retry on the tests? I suspect appveyor just had a failure not caused by this commit.

@Timer
Copy link
Contributor

Timer commented May 8, 2018

I just merged #4391, can you merge with next and we can see if these changes play well together? 😄

@Timer Timer merged commit 493a379 into facebook:next May 16, 2018
zmitry pushed a commit to zmitry/create-react-app that referenced this pull request Sep 30, 2018
@lock lock bot locked and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants