Skip to content

Commit 319b3f5

Browse files
authored
Use React 19 (#3291)
* Use React 19 * Specify TS 5.0 as min TS version in most dtslint tests * try patching dtslint * update lockfile * fixed TS error * dedupe `@types/react` * update react testing library * add `@testing-library/dom` * migrate tests * migrate more * moar * moar * fix * more * more * more * more * more * more * more * more * fix * migrate more tests * moar * moar * moar * moar * moar * more * more * more * tweak * more converted tests * fix thing * fix * tweak * fixed test * tweaks * unskip 2 tests * unskip again * stuff * fix streams * skip some tests * tweak * fix things * fix snap * fixed snapshot indent * fixed extra snapshot issue * strip-ansi * Require TS 5.1 * `useInsertionEffect` directly in `Global` * keep old peer dep range in `use-insertion-effect-with-fallbacks` * add changeset * fixed lockfile
1 parent e5d43fc commit 319b3f5

File tree

114 files changed

+2297
-2569
lines changed

Some content is hidden

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

114 files changed

+2297
-2569
lines changed

.changeset/amaranth-owls-dream.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@emotion/styled': major
3+
'@emotion/react': major
4+
---
5+
6+
Dropped support for older React versions. React 19 becomes the only compatible version with this package.

.github/workflows/main.yml

-10
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,6 @@ jobs:
4141
- name: Check Types
4242
run: yarn tsc:all
4343

44-
test_react18:
45-
name: Test React 18
46-
runs-on: ubuntu-latest
47-
steps:
48-
- uses: actions/checkout@v3
49-
- uses: ./.github/actions/ci-setup
50-
51-
- name: Run Tests with React 18
52-
run: yarn test:react18:ci
53-
5444
test_prod:
5545
name: Test Prod
5646
runs-on: ubuntu-latest
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/dist/index.js b/dist/index.js
2+
index 0a9abde5fbe918397794db0c0962129cf6bec3fa..26fe2b048b7fa898282d2d9d0dbd1719384b1f60 100644
3+
--- a/dist/index.js
4+
+++ b/dist/index.js
5+
@@ -8,9 +8,9 @@ const assert_1 = __importDefault(require("assert"));
6+
var TypeScriptVersion;
7+
(function (TypeScriptVersion) {
8+
/** Add to this list when a version actually ships. */
9+
- TypeScriptVersion.shipped = ["3.9", "4.0", "4.1", "4.2", "4.3", "4.4", "4.5", "4.6"];
10+
+ TypeScriptVersion.shipped = ["3.9", "4.0", "4.1", "4.2", "4.3", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5", "5.6", "5.7"];
11+
/** Add to this list when a version is available as typescript@next */
12+
- TypeScriptVersion.supported = [...TypeScriptVersion.shipped, "4.7"];
13+
+ TypeScriptVersion.supported = [...TypeScriptVersion.shipped, "5.8"];
14+
/** Add to this list when it will no longer be supported on Definitely Typed */
15+
TypeScriptVersion.unsupported = [
16+
"2.0",

docs/testing.mdx

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ expect.addSnapshotSerializer(createSerializer())
3434

3535
### Writing a test
3636

37-
Writing a test with `@emotion/jest` involves creating a snapshot from the `react-test-renderer`'s resulting JSON.
37+
Writing a test with `@emotion/jest` involves creating a snapshot from the `@testing-library/react`'s result.
3838

3939
```jsx
4040
import React from 'react'
41-
import renderer from 'react-test-renderer'
41+
import { render } from '@testing-library/react'
4242

4343
const Button = props => (
4444
<button
@@ -51,7 +51,7 @@ const Button = props => (
5151

5252
test('Button renders correctly', () => {
5353
expect(
54-
renderer.create(<Button>This is hotpink.</Button>).toJSON()
54+
render(<Button>This is hotpink.</Button>).container
5555
).toMatchSnapshot()
5656
})
5757
```
@@ -67,7 +67,7 @@ exports[`Button renders correctly 1`] = `
6767
}
6868
6969
<div
70-
className="emotion-0"
70+
class="emotion-0"
7171
>
7272
This is hotpink.
7373
</div>

jest-react18.config.js

-9
This file was deleted.

package.json

+8-11
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
"test:size": "npm-run-all build size",
1010
"test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch",
1111
"test": "jest",
12-
"test:react18": "jest -c jest-react18.config.js",
1312
"test:typescript": "yarn workspaces foreach --verbose --exclude emotion-monorepo run test:typescript",
1413
"test:ci": "jest --coverage --no-cache --ci --runInBand",
15-
"test:react18:ci": "yarn test:react18 --coverage --no-cache --ci --runInBand",
1614
"test:dist": "yarn build && jest -c jest.dist.js --no-cache --ci --runInBand",
1715
"test:prod": "jest -c jest.prod.js --no-cache --ci --runInBand",
1816
"lint:check": "eslint .",
@@ -185,10 +183,11 @@
185183
"@changesets/cli": "^2.27.7",
186184
"@manypkg/cli": "^0.19.1",
187185
"@preconstruct/cli": "^2.8.8",
188-
"@testing-library/react": "13.0.0-alpha.5",
186+
"@testing-library/dom": "^10.4.0",
187+
"@testing-library/react": "^16.1.0",
189188
"@types/jest": "^29.5.12",
190189
"@types/node": "^12.20.37",
191-
"@types/react": "18.3.12",
190+
"@types/react": "19.0.1",
192191
"@typescript-eslint/eslint-plugin": "^7.13.0",
193192
"@typescript-eslint/parser": "^7.13.0",
194193
"babel-check-duplicated-nodes": "^1.0.0",
@@ -226,14 +225,11 @@
226225
"polished": "^1.2.1",
227226
"prettier": "^3.3.2",
228227
"raf": "^3.4.0",
229-
"react": "16.14.0",
230-
"react-dom": "16.14.0",
228+
"react": "19.0.0",
229+
"react-dom": "19.0.0",
231230
"react-native": "^0.63.2",
232231
"react-primitives": "^0.8.1",
233-
"react-test-renderer": "16.8.6",
234-
"react18": "npm:[email protected]",
235-
"react18-dom": "npm:[email protected]",
236-
"react18-test-renderer": "npm:[email protected]",
232+
"react-test-renderer": "19.0.0",
237233
"svg-tag-names": "^1.1.1",
238234
"through": "^2.3.8",
239235
"typescript": "^5.4.5",
@@ -242,6 +238,7 @@
242238
},
243239
"packageManager": "[email protected]",
244240
"resolutions": {
245-
"@definitelytyped/[email protected]": "patch:@definitelytyped/dtslint@npm%3A0.0.112#./.yarn/patches/@definitelytyped-dtslint-npm-0.0.112-1e6b842976.patch"
241+
"@definitelytyped/[email protected]": "patch:@definitelytyped/dtslint@npm%3A0.0.112#./.yarn/patches/@definitelytyped-dtslint-npm-0.0.112-1e6b842976.patch",
242+
"@definitelytyped/typescript-versions@^0.0.112": "patch:@definitelytyped/typescript-versions@npm%3A0.0.112#./.yarn/patches/@definitelytyped-typescript-versions-npm-0.0.112-f668f50e03.patch"
246243
}
247244
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ exports[`component selector should be converted to use the emotion target classN
1010
}
1111
1212
<div
13-
className="emotion-0"
13+
class="emotion-0"
1414
>
1515
<div
16-
className="emotion-1 emotion-2"
16+
class="emotion-1 emotion-2"
1717
/>
1818
</div>
1919
`;

0 commit comments

Comments
 (0)