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

UX-373 Upgrade styled-components to 5.2 #686

Merged
merged 5 commits into from Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion babel.config.js
Expand Up @@ -12,7 +12,10 @@ module.exports = {
'@babel/preset-react',
'react-app',
],
plugins: ['@babel/plugin-proposal-class-properties'],
plugins: [
'@babel/plugin-proposal-class-properties',
['babel-plugin-styled-components', { ssr: true, displayName: false, namespace: 'sc-' }],
],
},
production: {
presets: [['@babel/preset-env'], '@babel/preset-react', 'react-app'],
Expand Down
6 changes: 3 additions & 3 deletions config/jest/setup.js
Expand Up @@ -2,8 +2,8 @@
import './raf';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import toJson from 'enzyme-to-json';
import * as matchers from './matchers'
import * as matchers from './matchers';
import 'jest-styled-components';
Copy link
Contributor Author

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


// Provides enzyme assertions.
// See https://github.com/blainekasten/enzyme-matchers#assertions
Expand All @@ -14,7 +14,7 @@ expect.extend(matchers);
Enzyme.configure({ adapter: new Adapter() });

// Fail tests on any warning
console.error = (message) => {
console.error = message => {
throw new Error(message);
};

Expand Down
3 changes: 2 additions & 1 deletion jest.config.json
Expand Up @@ -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"
Copy link
Contributor Author

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

}
}