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

Upgrade Jest website to Docusaurus v3 #14463

Merged
merged 17 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion constraints.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange2, Depende
% A list of exception to same version rule
\+ member(DependencyIdent, [
% Allow enzyme example workspace use a older version react and react-dom, because enzyme don't support react 17
'react', 'react-dom',
'react', 'react-dom', '@types/react',
slorber marked this conversation as resolved.
Show resolved Hide resolved
% Only RN should be bumped to react 18
'react-test-renderer',
% @types/node in the root need to stay on ~14.14.45
Expand Down
2 changes: 1 addition & 1 deletion docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ test('does not show prototypes for object and array inline', () => {

Default: `undefined`

The path to a module that can resolve test<->snapshot path. This config option lets you customize where Jest stores snapshot files on disk.
The path to a module that can resolve test\<->snapshot path. This config option lets you customize where Jest stores snapshot files on disk.

Comment on lines -1757 to 1758
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In MDX v2 this does not compile. Escaping is a good solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SimenB this can't be extracted as is to a docs prep PR because on MDX v1, \ will stay visible. The only solution that works on MDX v1 + v2 is test&lt;->snapshot which IMHO is much less maintainable compared to \<->.

For this reason I think it's better to keep this change in this PR

```js title="custom-resolver.js"
module.exports = {
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@types/babel__template": "^7.0.2",
"@types/node": "~14.14.45",
"@types/which": "^3.0.0",
"@types/ws": "8.5.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like the newer 8.5.5 is causing failures due to a breaking change (a type became non-generic while it was before)

"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"ansi-regex": "^5.0.1",
Expand Down Expand Up @@ -172,6 +173,7 @@
},
"resolutions": {
"@types/node": "~14.14.45",
"@types/react": "^18.2.21",
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 is the only way I was able to avoid TS issues. Other alternatives can be explored (reduce hoisting etc) but that looks fine to me?

"ansi-escapes/type-fest": "^2.0.0",
"babel-jest": "workspace:^",
"jest": "workspace:^",
Expand Down
8 changes: 4 additions & 4 deletions packages/pretty-format/src/__tests__/react.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -769,11 +769,11 @@ test('supports context Consumer with a child', () => {

expect(
formatElement(
React.createElement(Consumer, null, () =>
React.createElement('div', null, 'child'),
),
React.createElement(Consumer, {
children: () => React.createElement('div', null, 'child'),
}),
),
).toBe('<Context.Consumer>\n [Function anonymous]\n</Context.Consumer>');
).toBe('<Context.Consumer>\n [Function children]\n</Context.Consumer>');
Comment on lines -772 to +776
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With React 18 it seems ReactNode (3rd arg) doesn't accept a function anymore so I replaced it with props.children

});

test('ReactElement removes undefined props', () => {
Expand Down
22 changes: 11 additions & 11 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,25 @@
]
},
"dependencies": {
"@docusaurus/core": "^2.0.0",
"@docusaurus/plugin-client-redirects": "^2.0.0",
"@docusaurus/plugin-pwa": "^2.0.0",
"@docusaurus/preset-classic": "^2.0.0",
"@docusaurus/remark-plugin-npm2yarn": "^2.0.0",
"@docusaurus/core": "0.0.0-5658",
"@docusaurus/plugin-client-redirects": "0.0.0-5658",
"@docusaurus/plugin-pwa": "0.0.0-5658",
"@docusaurus/preset-classic": "0.0.0-5658",
"@docusaurus/remark-plugin-npm2yarn": "0.0.0-5658",
"clsx": "^2.0.0",
"docusaurus-remark-plugin-tab-blocks": "^1.2.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"docusaurus-remark-plugin-tab-blocks": "^2.0.0-beta",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-github-btn": "^1.3.0",
"react-lite-youtube-embed": "^2.2.2",
"react-markdown": "^8.0.0"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@crowdin/cli": "^3.5.2",
"@docusaurus/module-type-aliases": "^2.0.0",
"@tsconfig/docusaurus": "^1.0.5",
"@types/react": "^17.0.3",
"@docusaurus/module-type-aliases": "0.0.0-5658",
"@docusaurus/tsconfig": "0.0.0-5658",
"@types/react": "^18.2.21",
"graphql": "^16.3.0",
"graphql-request": "^6.0.0",
"js-yaml": "^4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion website/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
// This file is not used in compilation. It is here just for a nice editor experience.
"extends": "@tsconfig/docusaurus/tsconfig.json",
"extends": "@docusaurus/tsconfig",
"compilerOptions": {
"baseUrl": "."
}
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-29.4/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,7 @@ test('does not show prototypes for object and array inline', () => {

Default: `undefined`

The path to a module that can resolve test<->snapshot path. This config option lets you customize where Jest stores snapshot files on disk.
The path to a module that can resolve test\<->snapshot path. This config option lets you customize where Jest stores snapshot files on disk.

```js title="custom-resolver.js"
module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-29.5/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1718,7 +1718,7 @@ test('does not show prototypes for object and array inline', () => {

Default: `undefined`

The path to a module that can resolve test<->snapshot path. This config option lets you customize where Jest stores snapshot files on disk.
The path to a module that can resolve test\<->snapshot path. This config option lets you customize where Jest stores snapshot files on disk.

```js title="custom-resolver.js"
module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-29.6/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ test('does not show prototypes for object and array inline', () => {

Default: `undefined`

The path to a module that can resolve test<->snapshot path. This config option lets you customize where Jest stores snapshot files on disk.
The path to a module that can resolve test\<->snapshot path. This config option lets you customize where Jest stores snapshot files on disk.

```js title="custom-resolver.js"
module.exports = {
Expand Down
Loading
Loading