Skip to content

Commit e5d43fc

Browse files
authored
Drop Enzyme's support (#3292)
* Drop Enzyme's support * update lockfile * update snapshots * rename to setup-env * update snapshots agains
1 parent 6158389 commit e5d43fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+87
-2010
lines changed

.changeset/polite-items-cheat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@emotion/jest': major
3+
---
4+
5+
Drop support for Enzyme

docs/testing.mdx

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,9 @@ import { createSerializer } from '@emotion/jest'
3232
expect.addSnapshotSerializer(createSerializer())
3333
```
3434

35-
When using Enzyme, you can add `"@emotion/jest/enzyme-serializer"` instead.
36-
37-
```json
38-
{
39-
"snapshotSerializers": ["@emotion/jest/enzyme-serializer"]
40-
}
41-
```
42-
43-
Or use `expect.addSnapshotSerializer` to add it like this:
44-
45-
```javascript
46-
// also adds the enzyme-to-json serializer
47-
import { createEnzymeSerializer } from '@emotion/jest/enzyme-serializer'
48-
49-
expect.addSnapshotSerializer(createEnzymeSerializer())
50-
```
51-
5235
### Writing a test
5336

54-
Writing a test with `@emotion/jest` involves creating a snapshot from the `react-test-renderer` or `enzyme-to-json`'s resulting JSON.
37+
Writing a test with `@emotion/jest` involves creating a snapshot from the `react-test-renderer`'s resulting JSON.
5538

5639
```jsx
5740
import React from 'react'

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,6 @@
201201
"bundlesize": "^0.13.2",
202202
"codecov": "^2.3.1",
203203
"cssjanus": "^1.2.0",
204-
"enzyme": "^3.11.0",
205-
"enzyme-adapter-react-16": "^1.15.5",
206-
"enzyme-to-json": "^3.6.1",
207204
"eslint": "^8.57.0",
208205
"eslint-config-prettier": "^9.1.0",
209206
"eslint-config-react": "^1.1.7",

packages/cache/__tests__/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @jsx jsx */
2-
import 'test-utils/next-env'
2+
import 'test-utils/setup-env'
33
import { safeQuerySelector } from 'test-utils'
44
import createCache from '@emotion/cache'
55
import { jsx, CacheProvider } from '@emotion/react'

packages/css/test/__snapshots__/selectivity.test.js.snap

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,62 +15,62 @@ exports[`css complex nested media queries 1`] = `
1515
`;
1616

1717
exports[`css complex nested styles 1`] = `
18-
".css-52fshx {
18+
".css-1fh6au3 {
1919
color: blue;
2020
}
2121
22-
.css-52fshx:hover {
22+
.css-1fh6au3:hover {
2323
color: green;
2424
}
2525
26-
.css-52fshx:hover .name {
26+
.css-1fh6au3:hover .name {
2727
color: amethyst;
2828
}
2929
30-
.css-52fshx:hover .name:focus {
30+
.css-1fh6au3:hover .name:focus {
3131
color: burlywood;
3232
}
3333
3434
@media (min-width: 420px) {
35-
.css-52fshx:hover .name:focus {
35+
.css-1fh6au3:hover .name:focus {
3636
color: rebeccapurple;
3737
}
3838
}"
3939
`;
4040

4141
exports[`css handles media query merges 1`] = `
42-
".css-19kb3dc {
42+
".css-uzr6q5 {
4343
color: darkslateblue;
4444
color: red;
4545
color: purple;
4646
}
4747
4848
@media (min-width: 420px) {
49-
.css-19kb3dc {
49+
.css-uzr6q5 {
5050
color: amethyst;
5151
}
5252
}
5353
5454
@media (min-width: 640px) {
55-
.css-19kb3dc {
55+
.css-uzr6q5 {
5656
color: rebeccapurple;
5757
}
5858
}
5959
6060
@media (min-width: 960px) {
61-
.css-19kb3dc {
61+
.css-uzr6q5 {
6262
color: burlywood;
6363
}
6464
}
6565
6666
@media (min-width: 640px) {
67-
.css-19kb3dc {
67+
.css-uzr6q5 {
6868
color: blue;
6969
}
7070
}
7171
7272
@media (min-width: 640px) {
73-
.css-19kb3dc {
73+
.css-uzr6q5 {
7474
color: aquamarine;
7575
}
7676
}"

packages/css/test/component-selector.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'test-utils/legacy-env'
1+
import 'test-utils/setup-env'
22
import React from 'react'
33
import styled from '@emotion/styled'
44
import renderer from 'react-test-renderer'

packages/css/test/css.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'test-utils/legacy-env'
1+
import 'test-utils/setup-env'
22
import React from 'react'
33
import renderer from 'react-test-renderer'
44
import { css, flush, sheet } from '@emotion/css'

packages/css/test/cx.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'test-utils/legacy-env'
1+
import 'test-utils/setup-env'
22
import React from 'react'
33
import renderer from 'react-test-renderer'
44
import { css, cx } from '@emotion/css'

packages/css/test/inject-global.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'test-utils/legacy-env'
1+
import 'test-utils/setup-env'
22
import { injectGlobal, sheet, flush, css } from '@emotion/css'
33

44
describe('injectGlobal', () => {

packages/css/test/instance/css.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'test-utils/next-env'
1+
import 'test-utils/setup-env'
22
import React from 'react'
33
import renderer from 'react-test-renderer'
44
import { css as differentCss, flush, sheet } from './emotion-instance'

0 commit comments

Comments
 (0)