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
UX-373 Upgrade styled-components to 5.2 #686
Conversation
For reference: styled-components/jest-styled-components#297 |
clean
helper functionimport toJson from 'enzyme-to-json'; | ||
import * as matchers from './matchers' | ||
import * as matchers from './matchers'; | ||
import 'jest-styled-components'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Globally importing jest-styled-components
instead of in every test - this fixed the "could not resolve SC internals" errors
@@ -30,6 +30,7 @@ | |||
"^react-native$": "react-native-web", | |||
"\\.(css|scss)$": "identity-obj-proxy", | |||
"@sparkpost/matchbox-icons(.*)": "<rootDir>/packages/matchbox-icons/src", | |||
"@sparkpost/matchbox(.*)": "<rootDir>/packages/matchbox/src" | |||
"@sparkpost/matchbox(.*)": "<rootDir>/packages/matchbox/src", | |||
"^styled-components": "<rootDir>/node_modules/styled-components" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out we needed to resolve one styled-components module
shouldForwardProp: (prop, defaultFn) => !arr.includes(prop) && defaultFn(prop), | ||
...config, | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the helper function
What Changed
styled-components
v5.2jest-styled-components
v7styled-components
v5.1.0.jest-styled-components
in jest's setup file instead of in every test filewrappers
within arrow function.at(x)
in a few places that were detecting multiple DOM nodescleanProps
helper to filter out styling propsHow To Test or Verify
PR Checklist
type
label