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

Migration to Emotion 11 #17640

Merged
merged 20 commits into from Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from 8 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
6 changes: 3 additions & 3 deletions .babelrc.js
Expand Up @@ -55,7 +55,7 @@ module.exports = {
'@babel/plugin-syntax-dynamic-import',
['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }],
'babel-plugin-macros',
['emotion', { sourceMap: true, autoLabel: true }],
['@emotion', { sourceMap: true, autoLabel: 'always' }],
],
env: {
test: withTests,
Expand Down Expand Up @@ -90,7 +90,7 @@ module.exports = {
['@babel/plugin-proposal-private-property-in-object', { loose: true }],
['@babel/plugin-proposal-class-properties', { loose: true }],
'babel-plugin-macros',
['emotion', { sourceMap: true, autoLabel: true }],
['@emotion', { sourceMap: true, autoLabel: 'always' }],
'babel-plugin-add-react-displayname',
],
env: {
Expand Down Expand Up @@ -125,7 +125,7 @@ module.exports = {
],
],
plugins: [
'emotion',
'@emotion',
'babel-plugin-macros',
'@babel/plugin-transform-arrow-functions',
'@babel/plugin-transform-shorthand-properties',
Expand Down
2 changes: 1 addition & 1 deletion addons/storyshots/storyshots-core/package.json
Expand Up @@ -69,6 +69,7 @@
"devDependencies": {
"@angular/core": "^11.2.0",
"@angular/platform-browser-dynamic": "^11.2.0",
"@emotion/jest": "^11.8.0",
"@storybook/addon-docs": "6.5.0-alpha.51",
"@storybook/angular": "6.5.0-alpha.51",
"@storybook/react": "6.5.0-alpha.51",
Expand All @@ -77,7 +78,6 @@
"babel-loader": "^8.0.0",
"enzyme": "^3.11.0",
"enzyme-to-json": "^3.6.1",
"jest-emotion": "^10.0.32",
"jest-preset-angular": "^8.3.2",
"jest-vue-preprocessor": "^1.7.1",
"rxjs": "^6.6.3",
Expand Down
@@ -1,12 +1,9 @@
import path from 'path';
import { mount } from 'enzyme';
import { createSerializer as enzymeSerializer } from 'enzyme-to-json';
import { createSerializer as emotionSerializer } from 'jest-emotion';
import initStoryshots from '../dist/ts3.9';

initStoryshots({
framework: 'react',
configPath: path.join(__dirname, '..', '.storybook'),
renderer: mount,
snapshotSerializers: [enzymeSerializer(), emotionSerializer()],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was creating an infinite loop because the emotion serializer is already used in the root jest.config.js and this config was merged with this one here. As the result - 2 emotion serializers were applied here and this messed them up.

More details can be found here:
emotion-js/emotion#2704

});
3 changes: 0 additions & 3 deletions app/angular/src/server/framework-preset-angular-cli.test.ts
Expand Up @@ -797,9 +797,6 @@ const newWebpackConfiguration = (
modules: ['node_modules'],
mainFields: ['browser', 'main'],
alias: {
'@emotion/core': '/Users/joe/storybook/node_modules/@emotion/core',
ndelangen marked this conversation as resolved.
Show resolved Hide resolved
'@emotion/styled': '/Users/joe/storybook/node_modules/@emotion/styled',
'emotion-theming': '/Users/joe/storybook/node_modules/emotion-theming',
'@storybook/addons': '/Users/joe/storybook/lib/addons',
'@storybook/api': '/Users/joe/storybook/lib/api',
'@storybook/channels': '/Users/joe/storybook/lib/channels',
Expand Down
2 changes: 1 addition & 1 deletion examples/official-storybook/package.json
Expand Up @@ -12,6 +12,7 @@
"storyshots-puppeteer": "yarn run build-storybook && yarn run do-storyshots-puppeteer"
},
"devDependencies": {
"@emotion/jest": "^11.8.0",
"@packtracker/webpack-plugin": "^2.3.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
"@storybook/addon-a11y": "6.5.0-alpha.51",
Expand Down Expand Up @@ -49,7 +50,6 @@
"express": "^4.17.1",
"format-json": "^1.0.3",
"global": "^4.4.0",
"jest-emotion": "^10.0.32",
"lodash": "^4.17.21",
"paths.macro": "^3.0.1",
"prop-types": "^15.7.2",
Expand Down