diff --git a/.babelrc.js b/.babelrc.js index 5af9a9046c5d..b00deb2d4c20 100644 --- a/.babelrc.js +++ b/.babelrc.js @@ -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, @@ -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: { @@ -125,7 +125,7 @@ module.exports = { ], ], plugins: [ - 'emotion', + '@emotion', 'babel-plugin-macros', '@babel/plugin-transform-arrow-functions', '@babel/plugin-transform-shorthand-properties', diff --git a/addons/storyshots/storyshots-core/package.json b/addons/storyshots/storyshots-core/package.json index e3d404058275..a237503d47ac 100644 --- a/addons/storyshots/storyshots-core/package.json +++ b/addons/storyshots/storyshots-core/package.json @@ -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.58", "@storybook/angular": "6.5.0-alpha.58", "@storybook/react": "6.5.0-alpha.58", @@ -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", diff --git a/addons/storyshots/storyshots-core/stories/storyshot.enzyme.test.js b/addons/storyshots/storyshots-core/stories/storyshot.enzyme.test.js index ef3fb2f198cb..96e285722d44 100644 --- a/addons/storyshots/storyshots-core/stories/storyshot.enzyme.test.js +++ b/addons/storyshots/storyshots-core/stories/storyshot.enzyme.test.js @@ -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()], }); diff --git a/app/angular/src/server/framework-preset-angular-cli.test.ts b/app/angular/src/server/framework-preset-angular-cli.test.ts index 235ddead5e0a..b5e1b86eee2b 100644 --- a/app/angular/src/server/framework-preset-angular-cli.test.ts +++ b/app/angular/src/server/framework-preset-angular-cli.test.ts @@ -797,9 +797,6 @@ const newWebpackConfiguration = ( modules: ['node_modules'], mainFields: ['browser', 'main'], alias: { - '@emotion/core': '/Users/joe/storybook/node_modules/@emotion/core', - '@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', diff --git a/examples/official-storybook/package.json b/examples/official-storybook/package.json index 2253cab23721..8cc402ee6b41 100644 --- a/examples/official-storybook/package.json +++ b/examples/official-storybook/package.json @@ -11,6 +11,7 @@ "storyshots-puppeteer": "yarn run build-storybook && yarn run do-storyshots-puppeteer" }, "devDependencies": { + "@emotion/jest": "^11.8.0", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3", "@storybook/addon-a11y": "6.5.0-alpha.58", "@storybook/addon-actions": "6.5.0-alpha.58", @@ -47,7 +48,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", diff --git a/examples/react-ts/src/__snapshots__/storyshots.test.ts.snap b/examples/react-ts/src/__snapshots__/storyshots.test.ts.snap index e667fd935d97..c7c7e0bda05e 100644 --- a/examples/react-ts/src/__snapshots__/storyshots.test.ts.snap +++ b/examples/react-ts/src/__snapshots__/storyshots.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Storyshots Demo/AccountForm Standard 1`] = ` -.emotion-15 { +.emotion-0 { font-family: "Nunito Sans",-apple-system,".SFNSText-Regular","San Francisco",BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Helvetica,Arial,sans-serif; display: -webkit-box; display: -webkit-flex; @@ -20,7 +20,7 @@ exports[`Storyshots Demo/AccountForm Standard 1`] = ` border-radius: 7px; } -.emotion-2 { +.emotion-1 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -30,30 +30,30 @@ exports[`Storyshots Demo/AccountForm Standard 1`] = ` -ms-flex-align: center; align-items: center; -webkit-box-pack: center; - -webkit-justify-content: center; -ms-flex-pack: center; + -webkit-justify-content: center; justify-content: center; } -.emotion-0 { +.emotion-2 { height: 40px; z-index: 10; margin-left: 32px; } -.emotion-1 { +.emotion-3 { height: 40px; z-index: 1; left: -32px; position: relative; } -.emotion-3 { +.emotion-4 { margin-top: 20px; text-align: center; } -.emotion-14 { +.emotion-5 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -63,26 +63,26 @@ exports[`Storyshots Demo/AccountForm Standard 1`] = ` -ms-flex-align: flex-start; align-items: flex-start; -webkit-box-pack: center; - -webkit-justify-content: center; -ms-flex-pack: center; + -webkit-justify-content: center; justify-content: center; width: 350px; min-height: 189px; margin-top: 8px; } -.emotion-13 { +.emotion-6 { width: 100%; -webkit-align-self: flex-start; - -ms-flex-item-align: start; + -ms-flex-item-align: flex-start; align-self: flex-start; } -.emotion-13[aria-disabled="true"] { +.emotion-6[aria-disabled="true"] { opacity: 0.6; } -.emotion-6 { +.emotion-7 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -91,44 +91,45 @@ exports[`Storyshots Demo/AccountForm Standard 1`] = ` -ms-flex-direction: column; flex-direction: column; -webkit-box-pack: stretch; - -webkit-justify-content: stretch; -ms-flex-pack: stretch; + -webkit-justify-content: stretch; justify-content: stretch; margin-bottom: 10px; } -.emotion-4 { +.emotion-8 { font-size: 13px; font-weight: 500; margin-bottom: 6px; } -.emotion-5 { +.emotion-9 { font-size: 14px; color: #333333; padding: 10px 15px; border-radius: 4px; -webkit-appearance: none; -moz-appearance: none; + -ms-appearance: none; appearance: none; outline: none; border: 0 none; box-shadow: rgb(0 0 0 / 10%) 0px 0px 0px 1px inset; } -.emotion-5:focus { +.emotion-9:focus { box-shadow: rgb(30 167 253) 0px 0px 0px 1px inset; } -.emotion-5:active { +.emotion-9:active { box-shadow: rgb(30 167 253) 0px 0px 0px 1px inset; } -.emotion-5[aria-invalid="true"] { +.emotion-9[aria-invalid="true"] { box-shadow: rgb(255 68 0) 0px 0px 0px 1px inset; } -.emotion-12 { +.emotion-13 { -webkit-align-self: stretch; -ms-flex-item-align: stretch; align-self: stretch; @@ -138,17 +139,17 @@ exports[`Storyshots Demo/AccountForm Standard 1`] = ` display: flex; -webkit-box-pack: justify; -webkit-justify-content: space-between; - -ms-flex-pack: justify; justify-content: space-between; margin-top: 24px; } -.emotion-10 { +.emotion-14 { background-color: transparent; border: 0 none; outline: none; -webkit-appearance: none; -moz-appearance: none; + -ms-appearance: none; appearance: none; font-weight: 500; font-size: 12px; @@ -166,28 +167,29 @@ exports[`Storyshots Demo/AccountForm Standard 1`] = ` box-shadow: rgb(30 167 253 / 10%) 0 0 0 1px inset; } -.emotion-10:focus { +.emotion-14:focus { -webkit-text-decoration: underline; text-decoration: underline; font-weight: 700; } -.emotion-10:active { +.emotion-14:active { -webkit-text-decoration: underline; text-decoration: underline; font-weight: 700; } -.emotion-10[aria-disabled="true"] { +.emotion-14[aria-disabled="true"] { cursor: default; } -.emotion-11 { +.emotion-15 { background-color: transparent; border: 0 none; outline: none; -webkit-appearance: none; -moz-appearance: none; + -ms-appearance: none; appearance: none; font-weight: 500; font-size: 12px; @@ -203,31 +205,31 @@ exports[`Storyshots Demo/AccountForm Standard 1`] = ` color: #1EA7FD; } -.emotion-11:focus { +.emotion-15:focus { -webkit-text-decoration: underline; text-decoration: underline; font-weight: 700; } -.emotion-11:active { +.emotion-15:active { -webkit-text-decoration: underline; text-decoration: underline; font-weight: 700; } -.emotion-11[aria-disabled="true"] { +.emotion-15[aria-disabled="true"] { cursor: default; }
@@ -262,7 +264,7 @@ exports[`Storyshots Demo/AccountForm Standard 1`] = ` @@ -281,26 +283,26 @@ exports[`Storyshots Demo/AccountForm Standard 1`] = `

Create an account to join the Storybook community