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 6 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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ module.exports = {

The ideal configuration for Babel will depend on your project. See [Babel's docs](https://babeljs.io/docs/en/) for more details.

<details><summary markdown="span"><strong>Making your Babel config jest-aware</strong></summary>
<details>
<summary markdown="span"><strong>Making your Babel config jest-aware</strong></summary>
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.
This is the readme though so not a big deal but I updated it too because mdx docs have the exact same content.

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 change can be moved to a preparation PR and would work with both MDX v1 and v2


Jest will set `process.env.NODE_ENV` to `'test'` if it's not set to something else. You can use that in your configuration to conditionally setup only the compilation needed for Jest, e.g.

Expand Down
5 changes: 3 additions & 2 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ This option requires `collectCoverage` to be set to `true` or Jest to be invoked

<details>
<summary>Help:</summary>
If you are seeing coverage output such as...

If you are seeing coverage output such as...
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 not having a line break will wrap the summary in an extra useless paragraph. This leads browsers to ignore the nested summary tag and display the default label instead of the provided one.

CF problem reported by Argos here: https://app.argos-ci.com/slorber/jest-website-visual-tests/builds/11/56882867

CleanShot 2023-09-01 at 16 45 20@2x CleanShot 2023-09-01 at 16 45 32@2x

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 change can be moved to a preparation PR and would work with both MDX v1 and v2


```
=============================== Coverage summary ===============================
Expand Down Expand Up @@ -1753,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&lt;->snapshot path. This config option lets you customize where Jest stores snapshot files on disk.
slorber marked this conversation as resolved.
Show resolved Hide resolved

```js title="custom-resolver.js"
module.exports = {
Expand Down
3 changes: 2 additions & 1 deletion docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ module.exports = {

The ideal configuration for Babel will depend on your project. See [Babel's docs](https://babeljs.io/docs/en/) for more details.

<details><summary markdown="span"><strong>Making your Babel config jest-aware</strong></summary>
<details>
<summary markdown="span"><strong>Making your Babel config jest-aware</strong></summary>
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.

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 change can be moved to a preparation PR and would work with both MDX v1 and v2


Jest will set `process.env.NODE_ENV` to `'test'` if it's not set to something else. You can use that in your configuration to conditionally setup only the compilation needed for Jest, e.g.

Expand Down
2 changes: 1 addition & 1 deletion docs/MockFunctionAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Clears all information stored in the [`mockFn.mock.calls`](#mockfnmockcalls), [`

The [`clearMocks`](configuration#clearmocks-boolean) configuration option is available to clear mocks automatically before each tests.

:::warning
:::danger
Copy link
Contributor Author

Choose a reason for hiding this comment

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

:::warning is a legacy Docusaurus admonition alias that is not documented, see https://docusaurus.io/docs/markdown-features/admonitions

Issue reported by Argos due to default label change: https://app.argos-ci.com/slorber/jest-website-visual-tests/builds/11/56882879

CleanShot 2023-09-01 at 16 48 20@2x CleanShot 2023-09-01 at 16 48 44@2x

Using :::danger is the official red admonition name, keep the same label as before


Note: we are going to reintroduce :::warning soon, but it will be yellow instead of red (facebook/docusaurus#7558)

Copy link
Member

Choose a reason for hiding this comment

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

I think we wanted this to be yellow. That doesn't currently exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The yellow admonition is currently :::caution.

I'd suggest to change that in another PR: the goal of this PR is to focus on having no regression and not improving things ;)

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 change can be moved to a preparation PR and would work with both MDX v1 and v2

Choose a reason for hiding this comment

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

yellow is better!!

Copy link
Member

Choose a reason for hiding this comment

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

landed that yesterday #14493


Beware that `mockFn.mockClear()` will replace `mockFn.mock`, not just reset the values of its properties! You should, therefore, avoid assigning `mockFn.mock` to other variables, temporary or not, to make sure you don't access stale data.

Expand Down
20 changes: 10 additions & 10 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",
"@docusaurus/module-type-aliases": "0.0.0-5658",
"@tsconfig/docusaurus": "^1.0.5",
Copy link
Member

Choose a reason for hiding this comment

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

maybe bump this as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean? bump to what value?

Copy link
Member

Choose a reason for hiding this comment

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

v2 has been released

Copy link
Contributor Author

Choose a reason for hiding this comment

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

??? but it's a Docusaurus dependency, we want it to be v3 (canary) like the other docusaurus dependencies.

All official Docusaurus deps should use the exact same versions.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh! thought you were talking about the module above.

Actually you are right I forgot something, we are using a new official package @docusaurus/tsconfig now

Copy link
Member

Choose a reason for hiding this comment

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

just remove it based on tsconfig/bases#196?

Copy link
Member

Choose a reason for hiding this comment

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

Ahh! thought you were talking about the module above.

Actually you are right I forgot something, we are using a new official package @docusaurus/tsconfig now

👍

"@types/react": "^17.0.3",
"@types/react": "^18.2.21",
"graphql": "^16.3.0",
"graphql-request": "^6.0.0",
"js-yaml": "^4.1.0",
Expand Down
5 changes: 3 additions & 2 deletions website/versioned_docs/version-29.4/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ This option requires `collectCoverage` to be set to `true` or Jest to be invoked

<details>
<summary>Help:</summary>
If you are seeing coverage output such as...

If you are seeing coverage output such as...

```
=============================== Coverage summary ===============================
Expand Down Expand Up @@ -1682,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&lt;->snapshot path. This config option lets you customize where Jest stores snapshot files on disk.

```js title="custom-resolver.js"
module.exports = {
Expand Down
3 changes: 2 additions & 1 deletion website/versioned_docs/version-29.4/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ module.exports = {

The ideal configuration for Babel will depend on your project. See [Babel's docs](https://babeljs.io/docs/en/) for more details.

<details><summary markdown="span"><strong>Making your Babel config jest-aware</strong></summary>
<details>
<summary markdown="span"><strong>Making your Babel config jest-aware</strong></summary>

Jest will set `process.env.NODE_ENV` to `'test'` if it's not set to something else. You can use that in your configuration to conditionally setup only the compilation needed for Jest, e.g.

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-29.4/MockFunctionAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Clears all information stored in the [`mockFn.mock.calls`](#mockfnmockcalls), [`

The [`clearMocks`](configuration#clearmocks-boolean) configuration option is available to clear mocks automatically before each tests.

:::warning
:::danger

Beware that `mockFn.mockClear()` will replace `mockFn.mock`, not just reset the values of its properties! You should, therefore, avoid assigning `mockFn.mock` to other variables, temporary or not, to make sure you don't access stale data.

Expand Down
5 changes: 3 additions & 2 deletions website/versioned_docs/version-29.5/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ This option requires `collectCoverage` to be set to `true` or Jest to be invoked

<details>
<summary>Help:</summary>
If you are seeing coverage output such as...

If you are seeing coverage output such as...

```
=============================== Coverage summary ===============================
Expand Down Expand Up @@ -1717,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&lt;->snapshot path. This config option lets you customize where Jest stores snapshot files on disk.

```js title="custom-resolver.js"
module.exports = {
Expand Down
3 changes: 2 additions & 1 deletion website/versioned_docs/version-29.5/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ module.exports = {

The ideal configuration for Babel will depend on your project. See [Babel's docs](https://babeljs.io/docs/en/) for more details.

<details><summary markdown="span"><strong>Making your Babel config jest-aware</strong></summary>
<details>
<summary markdown="span"><strong>Making your Babel config jest-aware</strong></summary>

Jest will set `process.env.NODE_ENV` to `'test'` if it's not set to something else. You can use that in your configuration to conditionally setup only the compilation needed for Jest, e.g.

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-29.5/MockFunctionAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Clears all information stored in the [`mockFn.mock.calls`](#mockfnmockcalls), [`

The [`clearMocks`](configuration#clearmocks-boolean) configuration option is available to clear mocks automatically before each tests.

:::warning
:::danger

Beware that `mockFn.mockClear()` will replace `mockFn.mock`, not just reset the values of its properties! You should, therefore, avoid assigning `mockFn.mock` to other variables, temporary or not, to make sure you don't access stale data.

Expand Down
5 changes: 3 additions & 2 deletions website/versioned_docs/version-29.6/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ This option requires `collectCoverage` to be set to `true` or Jest to be invoked

<details>
<summary>Help:</summary>
If you are seeing coverage output such as...

If you are seeing coverage output such as...

```
=============================== Coverage summary ===============================
Expand Down Expand Up @@ -1753,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&lt;->snapshot path. This config option lets you customize where Jest stores snapshot files on disk.

```js title="custom-resolver.js"
module.exports = {
Expand Down
3 changes: 2 additions & 1 deletion website/versioned_docs/version-29.6/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ module.exports = {

The ideal configuration for Babel will depend on your project. See [Babel's docs](https://babeljs.io/docs/en/) for more details.

<details><summary markdown="span"><strong>Making your Babel config jest-aware</strong></summary>
<details>
<summary markdown="span"><strong>Making your Babel config jest-aware</strong></summary>

Jest will set `process.env.NODE_ENV` to `'test'` if it's not set to something else. You can use that in your configuration to conditionally setup only the compilation needed for Jest, e.g.

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-29.6/MockFunctionAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Clears all information stored in the [`mockFn.mock.calls`](#mockfnmockcalls), [`

The [`clearMocks`](configuration#clearmocks-boolean) configuration option is available to clear mocks automatically before each tests.

:::warning
:::danger

Beware that `mockFn.mockClear()` will replace `mockFn.mock`, not just reset the values of its properties! You should, therefore, avoid assigning `mockFn.mock` to other variables, temporary or not, to make sure you don't access stale data.

Expand Down
Loading
Loading