diff --git a/jest.config.mjs b/jest.config.mjs index e8e4f3d2359a..ca2be525b050 100644 --- a/jest.config.mjs +++ b/jest.config.mjs @@ -35,7 +35,7 @@ export default { // Default 5s timeout often fails on Windows :s, // see https://github.com/facebook/docusaurus/pull/8259 testTimeout: 15000, - setupFiles: ['./jest/setup.js'], + setupFiles: ['./jest/setup.ts'], testEnvironmentOptions: { url: 'https://docusaurus.io/', }, diff --git a/jest/setup.js b/jest/setup.js deleted file mode 100644 index 04cb06b8028a..000000000000 --- a/jest/setup.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import {TextEncoder} from 'util'; - -// Required for RTL renderHook SSR tests with React-18 -// See also https://github.com/testing-library/react-testing-library/issues/1120#issuecomment-1516132279 -global.TextEncoder = TextEncoder; diff --git a/jest/setup.ts b/jest/setup.ts new file mode 100644 index 000000000000..19909496dabb --- /dev/null +++ b/jest/setup.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// Currently not used anymore, but kept for potential future setup needs diff --git a/package.json b/package.json index 27299df25356..4080ee1e3a7a 100644 --- a/package.json +++ b/package.json @@ -79,14 +79,15 @@ "@prettier/plugin-xml": "^2.2.0", "@swc/core": "^1.7.14", "@swc/jest": "^0.2.39", - "@testing-library/react-hooks": "^8.0.1", + "@testing-library/dom": "^10.4.1", + "@testing-library/jest-dom": "^6.9.1", + "@testing-library/react": "^16.3.2", "@types/fs-extra": "^9.0.13", "@types/jest": "^30.0.0", "@types/lodash": "^4.14.197", "@types/node": "^18.16.19", "@types/prompts": "^2.4.4", "@types/react": "^19.2.10", - "@types/react-test-renderer": "^18.0.0", "@types/semver": "^7.5.0", "@types/shelljs": "^0.8.12", "@typescript-eslint/eslint-plugin": "^5.62.0", @@ -118,9 +119,8 @@ "patch-package": "^8.0.0", "postinstall-postinstall": "^2.1.0", "prettier": "^2.8.8", - "react": "^18.0.0", - "react-dom": "^18.0.0", - "react-test-renderer": "^18.0.0", + "react": "^19.2.4", + "react-dom": "^19.2.4", "rimraf": "^3.0.2", "sharp": "^0.32.3", "strip-ansi": "^6.0.1", @@ -129,6 +129,8 @@ "stylelint-config-standard": "^29.0.0", "typescript": "~5.8.2" }, - "resolutions": {}, + "resolutions": { + "**/pretty-format/react-is": "^19.2.4" + }, "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsSidebar.test.tsx b/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsSidebar.test.tsx index 2082a9779aef..4b50641e0a57 100644 --- a/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsSidebar.test.tsx +++ b/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsSidebar.test.tsx @@ -3,10 +3,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import React from 'react'; -import {renderHook} from '@testing-library/react-hooks'; +import {renderHook} from '@testing-library/react'; import {useDocsSidebar, DocsSidebarProvider} from '../docsSidebar'; import type {PropSidebar} from '@docusaurus/plugin-content-docs'; diff --git a/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsUtils.test.tsx b/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsUtils.test.tsx index 5d8b30a0cc74..06066da7712f 100644 --- a/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsUtils.test.tsx +++ b/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsUtils.test.tsx @@ -3,10 +3,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import React from 'react'; -import {renderHook} from '@testing-library/react-hooks'; +import {renderHook} from '@testing-library/react'; import {StaticRouter} from 'react-router-dom'; import {Context} from '@docusaurus/core/src/client/docusaurusContext'; import { diff --git a/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsVersion.test.tsx b/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsVersion.test.tsx index 972a824cd31f..7a5c4878ef4c 100644 --- a/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsVersion.test.tsx +++ b/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsVersion.test.tsx @@ -3,10 +3,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import React from 'react'; -import {renderHook} from '@testing-library/react-hooks'; +import {renderHook} from '@testing-library/react'; import {useDocsVersion, DocsVersionProvider} from '../docsVersion'; import type {PropVersionMetadata} from '@docusaurus/plugin-content-docs'; diff --git a/packages/docusaurus-plugin-ideal-image/src/theme/IdealImageLegacy/__tests__/__snapshots__/icon.js.snap b/packages/docusaurus-plugin-ideal-image/src/theme/IdealImageLegacy/__tests__/__snapshots__/icon.js.snap index 8018d313ffcb..9648d6e5e87a 100644 --- a/packages/docusaurus-plugin-ideal-image/src/theme/IdealImageLegacy/__tests__/__snapshots__/icon.js.snap +++ b/packages/docusaurus-plugin-ideal-image/src/theme/IdealImageLegacy/__tests__/__snapshots__/icon.js.snap @@ -2,9 +2,9 @@ exports[`Download icon Should render a snapshot that is good 1`] = ` { it(snapshotTestDescription, () => { - const download = renderer.create().toJSON(); - expect(download).toMatchSnapshot(); + const {container} = render(); + expect(container.firstElementChild).toMatchSnapshot(); }); }); describe('Loading icon', () => { it(snapshotTestDescription, () => { - const loading = renderer.create().toJSON(); - expect(loading).toMatchSnapshot(); + const {container} = render(); + expect(container.firstElementChild).toMatchSnapshot(); }); }); describe('Offline icon', () => { it(snapshotTestDescription, () => { - const offline = renderer.create().toJSON(); - expect(offline).toMatchSnapshot(); + const {container} = render(); + expect(container.firstElementChild).toMatchSnapshot(); }); }); describe('Warning icon', () => { it(snapshotTestDescription, () => { - const warning = renderer.create().toJSON(); - expect(warning).toMatchSnapshot(); + const {container} = render(); + expect(container.firstElementChild).toMatchSnapshot(); }); }); diff --git a/packages/docusaurus-theme-classic/package.json b/packages/docusaurus-theme-classic/package.json index 2fe48d0c5a8e..63fcff4e0a3d 100644 --- a/packages/docusaurus-theme-classic/package.json +++ b/packages/docusaurus-theme-classic/package.json @@ -51,7 +51,6 @@ "@types/prismjs": "^1.26.0", "@types/rtlcss": "^3.5.1", "fs-extra": "^11.1.1", - "react-test-renderer": "^18.0.0", "utility-types": "^3.10.0" }, "peerDependencies": { diff --git a/packages/docusaurus-theme-classic/src/theme/Tabs/__tests__/index.test.tsx b/packages/docusaurus-theme-classic/src/theme/Tabs/__tests__/index.test.tsx index 58a1a636fdbd..9da082ba61c9 100644 --- a/packages/docusaurus-theme-classic/src/theme/Tabs/__tests__/index.test.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Tabs/__tests__/index.test.tsx @@ -3,10 +3,15 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import React, {type ReactNode} from 'react'; -import renderer from 'react-test-renderer'; +import {render} from '@testing-library/react'; +import '@testing-library/jest-dom'; import {ScrollControllerProvider} from '@docusaurus/theme-common/internal'; import {StaticRouter} from 'react-router-dom'; import Tabs from '../index'; @@ -29,7 +34,7 @@ function TestProviders({ describe('Tabs', () => { it('rejects bad Tabs child', () => { expect(() => { - renderer.create( + render(
Naughty
@@ -43,7 +48,7 @@ describe('Tabs', () => { }); it('rejects bad Tabs defaultValue', () => { expect(() => { - renderer.create( + render( Tab 1 @@ -57,7 +62,7 @@ describe('Tabs', () => { }); it('rejects duplicate values', () => { expect(() => { - renderer.create( + render( Tab 1 @@ -75,7 +80,7 @@ describe('Tabs', () => { }); it('accepts valid Tabs config', () => { expect(() => { - renderer.create( + render( Tab 1 @@ -129,7 +134,7 @@ describe('Tabs', () => { it('accepts dynamic Tabs with number values', () => { expect(() => { const tabs = ['Apple', 'Banana', 'Carrot']; - renderer.create( + render( ({label: t, value: idx}))} @@ -146,7 +151,7 @@ describe('Tabs', () => { }); it('rejects if querystring is true, but groupId falsy', () => { expect(() => { - renderer.create( + render( Val1 @@ -161,7 +166,7 @@ describe('Tabs', () => { it('accept querystring=true when groupId is defined', () => { expect(() => { - renderer.create( + render( Val1 @@ -174,7 +179,7 @@ describe('Tabs', () => { it('accept querystring as string, but groupId falsy', () => { expect(() => { - renderer.create( + render( Val1 @@ -187,7 +192,7 @@ describe('Tabs', () => { it('accepts a single TabItem', () => { expect(() => { - renderer.create( + render( Val1 @@ -199,7 +204,7 @@ describe('Tabs', () => { it('allows a tab to be falsy', () => { expect(() => { - renderer.create( + render( Val1 diff --git a/packages/docusaurus-theme-common/src/utils/__tests__/reactUtils.test.ts b/packages/docusaurus-theme-common/src/utils/__tests__/reactUtils.test.ts index 81785b659a97..cbaff0b1aa77 100644 --- a/packages/docusaurus-theme-common/src/utils/__tests__/reactUtils.test.ts +++ b/packages/docusaurus-theme-common/src/utils/__tests__/reactUtils.test.ts @@ -3,9 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ -import {renderHook} from '@testing-library/react-hooks'; +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header +import {renderHook} from '@testing-library/react'; import {usePrevious, useShallowMemoObject} from '../reactUtils'; describe('usePrevious', () => { diff --git a/packages/docusaurus-theme-common/src/utils/__tests__/tocUtils.test.ts b/packages/docusaurus-theme-common/src/utils/__tests__/tocUtils.test.ts index 6424f8d341a9..dd57905dc326 100644 --- a/packages/docusaurus-theme-common/src/utils/__tests__/tocUtils.test.ts +++ b/packages/docusaurus-theme-common/src/utils/__tests__/tocUtils.test.ts @@ -1,11 +1,16 @@ /** + /** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ -import {renderHook} from '@testing-library/react-hooks'; +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header +import {renderHook} from '@testing-library/react'; import {useFilteredAndTreeifiedTOC, useTreeifiedTOC} from '../tocUtils'; import type {TOCItem} from '@docusaurus/mdx-loader'; diff --git a/packages/docusaurus-theme-common/src/utils/__tests__/useAlternatePageUtils.test.tsx b/packages/docusaurus-theme-common/src/utils/__tests__/useAlternatePageUtils.test.tsx index a16832a6489c..c347f72b7a17 100644 --- a/packages/docusaurus-theme-common/src/utils/__tests__/useAlternatePageUtils.test.tsx +++ b/packages/docusaurus-theme-common/src/utils/__tests__/useAlternatePageUtils.test.tsx @@ -3,10 +3,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import React from 'react'; -import {renderHook} from '@testing-library/react-hooks'; +import {renderHook} from '@testing-library/react'; import {StaticRouter} from 'react-router-dom'; import {Context} from '@docusaurus/core/src/client/docusaurusContext'; import {fromPartial} from '@total-typescript/shoehorn'; diff --git a/packages/docusaurus-theme-common/src/utils/__tests__/useLocalPathname.test.tsx b/packages/docusaurus-theme-common/src/utils/__tests__/useLocalPathname.test.tsx index d0b78511d00d..21b826097586 100644 --- a/packages/docusaurus-theme-common/src/utils/__tests__/useLocalPathname.test.tsx +++ b/packages/docusaurus-theme-common/src/utils/__tests__/useLocalPathname.test.tsx @@ -3,10 +3,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import React from 'react'; -import {renderHook} from '@testing-library/react-hooks'; +import {renderHook} from '@testing-library/react'; import {StaticRouter} from 'react-router-dom'; import {Context} from '@docusaurus/core/src/client/docusaurusContext'; import {useLocalPathname} from '../useLocalPathname'; diff --git a/packages/docusaurus-theme-common/src/utils/__tests__/usePluralForm.test.tsx b/packages/docusaurus-theme-common/src/utils/__tests__/usePluralForm.test.tsx index 81a251bb3c5e..37dc2114af24 100644 --- a/packages/docusaurus-theme-common/src/utils/__tests__/usePluralForm.test.tsx +++ b/packages/docusaurus-theme-common/src/utils/__tests__/usePluralForm.test.tsx @@ -3,11 +3,15 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import {jest} from '@jest/globals'; import React from 'react'; -import {renderHook} from '@testing-library/react-hooks'; +import {renderHook} from '@testing-library/react'; import {Context} from '@docusaurus/core/src/client/docusaurusContext'; import {usePluralForm} from '../usePluralForm'; import type {DocusaurusContext} from '@docusaurus/types'; @@ -19,6 +23,7 @@ describe('usePluralForm', () => { {children} ), }).result.current; + it('returns the right plural', () => { const mockUsePluralForm = createUsePluralFormMock({ i18n: { @@ -43,6 +48,7 @@ describe('usePluralForm', () => { expect(consoleMock.mock.calls[0]![0]).toMatchInlineSnapshot( `"For locale=zh-Hans, a maximum of 1 plural forms are expected (other), but the message contains 2: one|many"`, ); + consoleMock.mockRestore(); }); it('uses the last with not enough plurals', () => { @@ -67,14 +73,26 @@ describe('usePluralForm', () => { .spyOn(Intl, 'PluralRules') // @ts-expect-error: for testing when it doesn't exist .mockImplementation(() => undefined); + expect(mockUsePluralForm().selectMessage(1, 'one|many')).toBe('one'); - expect(mockUsePluralForm().selectMessage(10, 'one|many')).toBe('many'); + expect(consoleMock.mock.calls).toHaveLength(1); expect(consoleMock.mock.calls[0]![0]).toMatchInlineSnapshot(` "Failed to use Intl.PluralRules for locale "zh-Hans". Docusaurus will fallback to the default (English) implementation. Error: pluralRules.resolvedOptions is not a function " `); + + expect(mockUsePluralForm().selectMessage(10, 'one|many')).toBe('many'); + expect(consoleMock.mock.calls).toHaveLength(2); + expect(consoleMock.mock.calls[1]![0]).toMatchInlineSnapshot(` + "Failed to use Intl.PluralRules for locale "zh-Hans". + Docusaurus will fallback to the default (English) implementation. + Error: pluralRules.resolvedOptions is not a function + " + `); + + consoleMock.mockRestore(); pluralMock.mockRestore(); }); }); diff --git a/packages/docusaurus-theme-common/src/utils/storageUtils.ts b/packages/docusaurus-theme-common/src/utils/storageUtils.ts index b62cabd94545..32b667854ad5 100644 --- a/packages/docusaurus-theme-common/src/utils/storageUtils.ts +++ b/packages/docusaurus-theme-common/src/utils/storageUtils.ts @@ -229,10 +229,6 @@ export function useStorageSlot( const currentValue = useSyncExternalStore( listen, () => { - // react-test-renderer (deprecated) never call getServerSnapshot() :/ - if (process.env.NODE_ENV === 'test') { - return null; - } return storageSlot.get(); }, () => null, diff --git a/packages/docusaurus-theme-mermaid/package.json b/packages/docusaurus-theme-mermaid/package.json index 11336abde4bf..db58cd8a2608 100644 --- a/packages/docusaurus-theme-mermaid/package.json +++ b/packages/docusaurus-theme-mermaid/package.json @@ -41,9 +41,7 @@ "mermaid": ">=11.6.0", "tslib": "^2.6.0" }, - "devDependencies": { - "react-test-renderer": "^18.0.0" - }, + "devDependencies": {}, "peerDependencies": { "@mermaid-js/layout-elk": "^0.1.9", "react": "^18.0.0 || ^19.0.0", diff --git a/packages/docusaurus-utils/package.json b/packages/docusaurus-utils/package.json index 7e775a011758..c31247b4e519 100644 --- a/packages/docusaurus-utils/package.json +++ b/packages/docusaurus-utils/package.json @@ -47,7 +47,7 @@ "@types/dedent": "^0.7.0", "@types/github-slugger": "^1.3.0", "@types/micromatch": "^4.0.2", - "@types/react-dom": "^18.2.7", + "@types/react-dom": "^19.2.3", "dedent": "^0.7.0", "tmp-promise": "^3.0.3" } diff --git a/packages/docusaurus/package.json b/packages/docusaurus/package.json index 30e26ce7a1e9..0ba34a2bfdd2 100644 --- a/packages/docusaurus/package.json +++ b/packages/docusaurus/package.json @@ -81,12 +81,11 @@ "@docusaurus/types": "3.9.2", "@total-typescript/shoehorn": "^0.1.2", "@types/detect-port": "^1.3.3", - "@types/react-dom": "^18.2.7", + "@types/react-dom": "^19.2.3", "@types/react-router-config": "^5.0.7", "@types/serve-handler": "^6.1.4", "@types/update-notifier": "^6.0.4", "@types/webpack-bundle-analyzer": "^4.7.0", - "react-test-renderer": "^18.0.0", "tmp-promise": "^3.0.3", "tree-node-cli": "^1.6.0" }, diff --git a/packages/docusaurus/src/client/__tests__/browserContext.test.tsx b/packages/docusaurus/src/client/__tests__/browserContext.test.tsx index 40fb454fbee9..7b7d36d3e806 100644 --- a/packages/docusaurus/src/client/__tests__/browserContext.test.tsx +++ b/packages/docusaurus/src/client/__tests__/browserContext.test.tsx @@ -10,18 +10,21 @@ // Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 // eslint-disable-next-line header/header import React from 'react'; -// TODO migrate to @testing-library/react when SSR rendering possible -// See https://github.com/testing-library/react-testing-library/issues/1120 -import {renderHook} from '@testing-library/react-hooks/server'; +import {renderHook} from '@testing-library/react'; import {BrowserContextProvider} from '../browserContext'; import useIsBrowser from '../exports/useIsBrowser'; describe('BrowserContextProvider', () => { - const {result, hydrate} = renderHook(() => useIsBrowser(), { + const {result} = renderHook(() => useIsBrowser(), { wrapper: ({children}) => ( {children} ), }); + + /* + TODO it seems not really possible to test before hydration anymore + See https://github.com/testing-library/react-testing-library/issues/1120 + it('has value false on first render', () => { expect(result.current).toBe(false); }); @@ -29,4 +32,9 @@ describe('BrowserContextProvider', () => { hydrate(); expect(result.current).toBe(true); }); + */ + + it('has value true', () => { + expect(result.current).toBe(true); + }); }); diff --git a/packages/docusaurus/src/client/__tests__/docusaurusContext.test.tsx b/packages/docusaurus/src/client/__tests__/docusaurusContext.test.tsx index 24713c596f5c..b3c3ff38e367 100644 --- a/packages/docusaurus/src/client/__tests__/docusaurusContext.test.tsx +++ b/packages/docusaurus/src/client/__tests__/docusaurusContext.test.tsx @@ -10,21 +10,20 @@ // Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 // eslint-disable-next-line header/header import React from 'react'; -// TODO migrate to @testing-library/react when SSR rendering possible -// See https://github.com/testing-library/react-testing-library/issues/1120 -import {renderHook} from '@testing-library/react-hooks/server'; +import {renderHook} from '@testing-library/react'; import {DocusaurusContextProvider} from '../docusaurusContext'; import useDocusaurusContext from '../exports/useDocusaurusContext'; // This test currently isn't quite useful because the @generated aliases point // to the empty modules. Maybe we can point that to fixtures in the future. describe('DocusaurusContextProvider', () => { - const {result, hydrate} = renderHook(() => useDocusaurusContext(), { + const {result} = renderHook(() => useDocusaurusContext(), { wrapper: ({children}) => ( {children} ), }); const value = result.current; + it('returns right value', () => { expect(value).toMatchInlineSnapshot(` { @@ -36,8 +35,4 @@ describe('DocusaurusContextProvider', () => { } `); }); - it('has reference-equal value on hydration', () => { - hydrate(); - expect(result.current).toBe(value); - }); }); diff --git a/packages/docusaurus/src/client/__tests__/routeContext.test.tsx b/packages/docusaurus/src/client/__tests__/routeContext.test.tsx index bb9e3078b5eb..b90c6d66e6f5 100644 --- a/packages/docusaurus/src/client/__tests__/routeContext.test.tsx +++ b/packages/docusaurus/src/client/__tests__/routeContext.test.tsx @@ -3,12 +3,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import React from 'react'; -// TODO migrate to @testing-library/react when SSR rendering possible -// See https://github.com/testing-library/react-testing-library/issues/1120 -import {renderHook} from '@testing-library/react-hooks/server'; +import {renderHook} from '@testing-library/react'; import {RouteContextProvider} from '../routeContext'; import useRouteContext from '../exports/useRouteContext'; diff --git a/packages/docusaurus/src/client/exports/__tests__/BrowserOnly.test.tsx b/packages/docusaurus/src/client/exports/__tests__/BrowserOnly.test.tsx index 989bdbc7b3ac..866113fc9c43 100644 --- a/packages/docusaurus/src/client/exports/__tests__/BrowserOnly.test.tsx +++ b/packages/docusaurus/src/client/exports/__tests__/BrowserOnly.test.tsx @@ -10,7 +10,8 @@ // Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 // eslint-disable-next-line header/header import React from 'react'; -import renderer from 'react-test-renderer'; +import {render} from '@testing-library/react'; +import '@testing-library/jest-dom'; import BrowserOnly from '../BrowserOnly'; import {Context} from '../../browserContext'; @@ -29,16 +30,14 @@ describe('', () => { it('rejects react element children', () => { process.env.NODE_ENV = 'development'; expect(() => - renderer - .create( - - - {/* @ts-expect-error test */} - {window.location.href} - - , - ) - .toJSON(), + render( + + + {/* @ts-expect-error test */} + {window.location.href} + + , + ), ).toThrowErrorMatchingInlineSnapshot(` "Docusaurus error: The children of must be a "render function", e.g. {() => {window.location.href}}. Current type: React element" @@ -48,7 +47,7 @@ describe('', () => { it('rejects string children', () => { process.env.NODE_ENV = 'development'; expect(() => { - renderer.create( + render( {/* @ts-expect-error test */} @@ -61,17 +60,14 @@ describe('', () => { }); it('accepts valid children', () => { - expect( - renderer - .create( - - Loading}> - {() => {window.location.href}} - - , - ) - .toJSON(), - ).toMatchInlineSnapshot(` + const {container} = render( + + Loading}> + {() => {window.location.href}} + + , + ); + expect(container.firstElementChild).toMatchInlineSnapshot(` https://docusaurus.io/ @@ -79,17 +75,14 @@ describe('', () => { }); it('returns fallback when not in browser', () => { - expect( - renderer - .create( - - Loading}> - {() => {window.location.href}} - - , - ) - .toJSON(), - ).toMatchInlineSnapshot(` + const {container} = render( + + Loading}> + {() => {window.location.href}} + + , + ); + expect(container.firstElementChild).toMatchInlineSnapshot(` Loading @@ -97,16 +90,11 @@ describe('', () => { }); it('gracefully falls back', () => { - expect( - renderer - .create( - - - {() => {window.location.href}} - - , - ) - .toJSON(), - ).toMatchInlineSnapshot(`null`); + const {container} = render( + + {() => {window.location.href}} + , + ); + expect(container.firstElementChild).toMatchInlineSnapshot(`null`); }); }); diff --git a/packages/docusaurus/src/client/exports/__tests__/Head.test.tsx b/packages/docusaurus/src/client/exports/__tests__/Head.test.tsx index 067fc9ea25ee..82a203bd7289 100644 --- a/packages/docusaurus/src/client/exports/__tests__/Head.test.tsx +++ b/packages/docusaurus/src/client/exports/__tests__/Head.test.tsx @@ -3,42 +3,79 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import React from 'react'; -import {type FilledContext, HelmetProvider} from 'react-helmet-async'; -import renderer from 'react-test-renderer'; +import {render} from '@testing-library/react'; +import '@testing-library/jest-dom'; +import {HelmetProvider} from 'react-helmet-async'; + import Head from '../Head'; describe('Head', () => { it('does exactly what Helmet does', () => { - const context = {}; - expect( - renderer - .create( - - - - - - - - - - - - -
Content
-
, - ) - .toJSON(), - ).toMatchSnapshot(); - expect((context as FilledContext).helmet).toMatchSnapshot(); + const helmetContext = {}; + + const {container} = render( + + + + + + + + + + + + +
Content
+
, + ); + + expect(container.firstElementChild).toMatchInlineSnapshot(` +
+ Content +
+ `); + expect(helmetContext).toMatchInlineSnapshot(` + { + "helmet": + + + + + + + </head> + <body /> + </html>, + } + `); }); }); diff --git a/packages/docusaurus/src/client/exports/__tests__/Interpolate.test.tsx b/packages/docusaurus/src/client/exports/__tests__/Interpolate.test.tsx index c04ef1bd42b2..8cca6551cdff 100644 --- a/packages/docusaurus/src/client/exports/__tests__/Interpolate.test.tsx +++ b/packages/docusaurus/src/client/exports/__tests__/Interpolate.test.tsx @@ -3,10 +3,15 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import React from 'react'; -import renderer from 'react-test-renderer'; +import {render} from '@testing-library/react'; +import '@testing-library/jest-dom'; import Interpolate, {interpolate} from '../Interpolate'; describe('interpolate', () => { @@ -66,13 +71,35 @@ describe('interpolate', () => { it('placeholders with JSX values', () => { const text = 'Hello {name} how are you {day}?'; const values = {name: <b>Sébastien</b>, day: <span>today</span>}; - expect(interpolate(text, values)).toMatchSnapshot(); + expect(interpolate(text, values)).toMatchInlineSnapshot(` + [ + "Hello ", + <b> + Sébastien + </b>, + " how are you ", + <span> + today + </span>, + "?", + ] + `); }); it('placeholders with mixed vales', () => { const text = 'Hello {name} how are you {day}?'; const values = {name: 'Sébastien', day: <span>today</span>}; - expect(interpolate(text, values)).toMatchSnapshot(); + expect(interpolate(text, values)).toMatchInlineSnapshot(` + [ + "Hello ", + "Sébastien", + " how are you ", + <span> + today + </span>, + "?", + ] + `); }); it('acceptance test', () => { @@ -83,26 +110,36 @@ describe('interpolate', () => { extraUselessValue1: <div>test</div>, extraUselessValue2: 'hi', }; - expect(interpolate(text, values)).toMatchSnapshot(); + expect(interpolate(text, values)).toMatchInlineSnapshot(` + [ + "Hello ", + "Sébastien", + " how are you ", + <span> + today + </span>, + "? Another ", + "{unprovidedValue}", + "!", + ] + `); }); }); describe('<Interpolate>', () => { it('without placeholders', () => { const text = 'Hello how are you?'; - expect(renderer.create(<Interpolate>{text}</Interpolate>).toJSON()).toEqual( - text, - ); + const {container} = render(<Interpolate>{text}</Interpolate>); + expect(container).toHaveTextContent(text); }); it('placeholders with string values', () => { const text = 'Hello {name} how are you {day}?'; const values = {name: 'Sébastien', day: 'today'}; - expect( - renderer - .create(<Interpolate values={values}>{text}</Interpolate>) - .toJSON(), - ).toMatchInlineSnapshot(`"Hello Sébastien how are you today?"`); + const {container} = render( + <Interpolate values={values}>{text}</Interpolate>, + ); + expect(container).toHaveTextContent('Hello Sébastien how are you today?'); }); it('acceptance test', () => { @@ -113,16 +150,17 @@ describe('<Interpolate>', () => { extraUselessValue1: <div>test</div>, extraUselessValue2: 'hi', }; - expect( - renderer - .create(<Interpolate values={values}>{text}</Interpolate>) - .toJSON(), - ).toMatchSnapshot(); + const {container} = render( + <Interpolate values={values}>{text}</Interpolate>, + ); + expect(container.innerHTML).toMatchInlineSnapshot( + `"Hello Sébastien how are you <span>today</span>? Another {unprovidedValue}!"`, + ); }); it('rejects when children is not string', () => { expect(() => - renderer.create( + render( <Interpolate> <span>aaa</span> </Interpolate>, @@ -131,7 +169,7 @@ describe('<Interpolate>', () => { `"The Docusaurus <Interpolate> component only accept simple string values. Received: React element"`, ); expect(() => - renderer.create(<Interpolate>{null}</Interpolate>), + render(<Interpolate>{null}</Interpolate>), ).toThrowErrorMatchingInlineSnapshot( `"The Docusaurus <Interpolate> component only accept simple string values. Received: object"`, ); diff --git a/packages/docusaurus/src/client/exports/__tests__/Link.test.tsx b/packages/docusaurus/src/client/exports/__tests__/Link.test.tsx index 392336a984d6..0be84340a5c7 100644 --- a/packages/docusaurus/src/client/exports/__tests__/Link.test.tsx +++ b/packages/docusaurus/src/client/exports/__tests__/Link.test.tsx @@ -3,17 +3,26 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ -/* eslint-disable jsx-a11y/anchor-is-valid */ +/* eslint-disable jsx-a11y/anchor-is-valid */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import React, {type ReactNode} from 'react'; -import renderer from 'react-test-renderer'; +import {render as renderRTL} from '@testing-library/react'; +import '@testing-library/jest-dom'; import {fromPartial} from '@total-typescript/shoehorn'; import {StaticRouter} from 'react-router-dom'; import Link from '../Link'; import {Context} from '../../docusaurusContext'; import type {DocusaurusContext} from '@docusaurus/types'; +window.docusaurus = { + prefetch: jest.fn(), +}; + type Options = { trailingSlash: boolean | undefined; baseUrl: string; @@ -52,15 +61,11 @@ function createLinkRenderer(defaultRendererOptions: Partial<Options> = {}) { ...testOptions, }; const docusaurusContext = createDocusaurusContext(options); - return renderer - .create( - <StaticRouter location={options.currentLocation} context={{}}> - <Context.Provider value={docusaurusContext}> - {linkJsx} - </Context.Provider> - </StaticRouter>, - ) - .toJSON(); + return renderRTL( + <StaticRouter location={options.currentLocation} context={{}}> + <Context.Provider value={docusaurusContext}>{linkJsx}</Context.Provider> + </StaticRouter>, + ); }; } @@ -69,75 +74,72 @@ describe('<Link>', () => { const render = createLinkRenderer({router: 'browser'}); it("can render '/docs/intro'", () => { - expect(render(<Link to="/docs/intro" />)).toMatchInlineSnapshot(` + const {container} = render(<Link to="/docs/intro" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="react-router" href="/docs/intro" - onClick={[Function]} - onMouseEnter={[Function]} - onTouchStart={[Function]} /> `); }); it("can render '/docs/intro' with baseUrl /baseUrl/", () => { - expect(render(<Link to="/docs/intro" />, {baseUrl: '/baseUrl/'})) - .toMatchInlineSnapshot(` + const {container} = render(<Link to="/docs/intro" />, { + baseUrl: '/baseUrl/', + }); + + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="react-router" href="/baseUrl/docs/intro" - onClick={[Function]} - onMouseEnter={[Function]} - onTouchStart={[Function]} /> `); }); it("can render '/docs/intro' with baseUrl /docs/", () => { + const {container} = render(<Link to="/docs/intro" />, { + baseUrl: '/docs/', + }); + // TODO Docusaurus v4 ? // Change weird historical baseUrl behavior // we should link to /docs/docs/intro, not /docs/intro // see https://github.com/facebook/docusaurus/issues/6294 - expect(render(<Link to="/docs/intro" />, {baseUrl: '/docs/'})) - .toMatchInlineSnapshot(` + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="react-router" href="/docs/intro" - onClick={[Function]} - onMouseEnter={[Function]} - onTouchStart={[Function]} /> `); }); it("can render '/docs/intro' with trailingSlash true", () => { - expect(render(<Link to="/docs/intro" />, {trailingSlash: true})) - .toMatchInlineSnapshot(` + const {container} = render(<Link to="/docs/intro" />, { + trailingSlash: true, + }); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="react-router" href="/docs/intro/" - onClick={[Function]} - onMouseEnter={[Function]} - onTouchStart={[Function]} /> `); }); it("can render '/docs/intro/' with trailingSlash false", () => { - expect(render(<Link to="/docs/intro/" />, {trailingSlash: false})) - .toMatchInlineSnapshot(` + const {container} = render(<Link to="/docs/intro/" />, { + trailingSlash: false, + }); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="react-router" href="/docs/intro" - onClick={[Function]} - onMouseEnter={[Function]} - onTouchStart={[Function]} /> `); }); it("can render '#anchor'", () => { - expect(render(<Link to="#anchor" />)).toMatchInlineSnapshot(` + const {container} = render(<Link to="#anchor" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="regular" href="#anchor" @@ -146,43 +148,38 @@ describe('<Link>', () => { }); it("can render '/docs/intro#anchor'", () => { - expect(render(<Link to="/docs/intro#anchor" />)).toMatchInlineSnapshot(` + const {container} = render(<Link to="/docs/intro#anchor" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="react-router" href="/docs/intro#anchor" - onClick={[Function]} - onMouseEnter={[Function]} - onTouchStart={[Function]} /> `); }); it("can render '/docs/intro/#anchor'", () => { - expect(render(<Link to="/docs/intro/#anchor" />)).toMatchInlineSnapshot(` + const {container} = render(<Link to="/docs/intro/#anchor" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="react-router" href="/docs/intro/#anchor" - onClick={[Function]} - onMouseEnter={[Function]} - onTouchStart={[Function]} /> `); }); it("can render '/pathname?qs#anchor'", () => { - expect(render(<Link to="/pathname?qs#anchor" />)).toMatchInlineSnapshot(` + const {container} = render(<Link to="/pathname?qs#anchor" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="react-router" href="/pathname?qs#anchor" - onClick={[Function]} - onMouseEnter={[Function]} - onTouchStart={[Function]} /> `); }); it("can render ''", () => { - expect(render(<Link to="" />)).toMatchInlineSnapshot(` + const {container} = render(<Link to="" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="regular" /> @@ -190,45 +187,38 @@ describe('<Link>', () => { }); it("can render 'relativeDoc'", () => { - expect(render(<Link to="relativeDoc" />)).toMatchInlineSnapshot(` + const {container} = render(<Link to="relativeDoc" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="react-router" href="/sub/category/relativeDoc" - onClick={[Function]} - onMouseEnter={[Function]} - onTouchStart={[Function]} /> `); }); it("can render './relativeDoc'", () => { - expect(render(<Link to="./relativeDoc" />)).toMatchInlineSnapshot(` + const {container} = render(<Link to="./relativeDoc" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="react-router" href="/sub/category/relativeDoc" - onClick={[Function]} - onMouseEnter={[Function]} - onTouchStart={[Function]} /> `); }); it("can render './../relativeDoc?qs#anchor'", () => { - expect(render(<Link to="./../relativeDoc?qs#anchor" />)) - .toMatchInlineSnapshot(` + const {container} = render(<Link to="./../relativeDoc?qs#anchor" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="react-router" href="/sub/relativeDoc?qs#anchor" - onClick={[Function]} - onMouseEnter={[Function]} - onTouchStart={[Function]} /> `); }); it("can render 'https://example.com/xyz'", () => { - expect(render(<Link to="https://example.com/xyz" />)) - .toMatchInlineSnapshot(` + const {container} = render(<Link to="https://example.com/xyz" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="regular" href="https://example.com/xyz" @@ -239,8 +229,8 @@ describe('<Link>', () => { }); it("can render 'pathname:///docs/intro'", () => { - expect(render(<Link to="pathname:///docs/intro" />)) - .toMatchInlineSnapshot(` + const {container} = render(<Link to="pathname:///docs/intro" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="regular" href="/docs/intro" @@ -251,8 +241,8 @@ describe('<Link>', () => { }); it("can render 'pathname://docs/intro'", () => { - expect(render(<Link to="pathname://docs/intro" />)) - .toMatchInlineSnapshot(` + const {container} = render(<Link to="pathname://docs/intro" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="regular" href="docs/intro" @@ -263,9 +253,10 @@ describe('<Link>', () => { }); it("can render 'pathname:///docs/intro' with baseUrl /baseUrl/", () => { - expect( - render(<Link to="pathname:///docs/intro" />, {baseUrl: '/baseUrl/'}), - ).toMatchInlineSnapshot(` + const {container} = render(<Link to="pathname:///docs/intro" />, { + baseUrl: '/baseUrl/', + }); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="regular" href="/baseUrl/docs/intro" @@ -276,8 +267,10 @@ describe('<Link>', () => { }); it("can render 'pathname:///docs/intro' with target _self", () => { - expect(render(<Link to="pathname:///docs/intro" target="_self" />)) - .toMatchInlineSnapshot(` + const {container} = render( + <Link to="pathname:///docs/intro" target="_self" />, + ); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="regular" href="/docs/intro" @@ -288,9 +281,10 @@ describe('<Link>', () => { }); it("can render 'pathname:///docs/intro with trailingSlash: true", () => { - expect( - render(<Link to="pathname:///docs/intro" />, {trailingSlash: true}), - ).toMatchInlineSnapshot(` + const {container} = render(<Link to="pathname:///docs/intro" />, { + trailingSlash: true, + }); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="regular" href="/docs/intro" @@ -305,13 +299,11 @@ describe('<Link>', () => { const render = createLinkRenderer({router: 'hash'}); it("can render '/docs/intro'", () => { - expect(render(<Link to="/docs/intro" />)).toMatchInlineSnapshot(` + const {container} = render(<Link to="/docs/intro" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="react-router" href="/docs/intro" - onClick={[Function]} - onMouseEnter={[Function]} - onTouchStart={[Function]} /> `); }); @@ -319,13 +311,11 @@ describe('<Link>', () => { it("can render '#anchor'", () => { // It's important to use React Router link for hash router anchors // See https://github.com/facebook/docusaurus/pull/10311 - expect(render(<Link to="#anchor" />)).toMatchInlineSnapshot(` + const {container} = render(<Link to="#anchor" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="react-router" href="/sub/category/currentPathname#anchor" - onClick={[Function]} - onMouseEnter={[Function]} - onTouchStart={[Function]} /> `); }); @@ -333,13 +323,11 @@ describe('<Link>', () => { it("can render './relativeDoc'", () => { // Not sure to remember exactly what's this edge case about // still worth it to capture behavior in tests - expect(render(<Link to="./relativeDoc" />)).toMatchInlineSnapshot(` + const {container} = render(<Link to="./relativeDoc" />); + expect(container.firstElementChild).toMatchInlineSnapshot(` <a data-test-link-type="react-router" href="/relativeDoc" - onClick={[Function]} - onMouseEnter={[Function]} - onTouchStart={[Function]} /> `); }); diff --git a/packages/docusaurus/src/client/exports/__tests__/Translate.test.tsx b/packages/docusaurus/src/client/exports/__tests__/Translate.test.tsx index 9c164ae36739..e9af1b251937 100644 --- a/packages/docusaurus/src/client/exports/__tests__/Translate.test.tsx +++ b/packages/docusaurus/src/client/exports/__tests__/Translate.test.tsx @@ -3,10 +3,16 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import React from 'react'; -import renderer from 'react-test-renderer'; +import {render} from '@testing-library/react'; +import '@testing-library/jest-dom'; + import Translate, {translate} from '../Translate'; describe('translate', () => { @@ -35,41 +41,34 @@ describe('translate', () => { }); describe('<Translate>', () => { - it('accepts id and uses it as fallback', () => { - expect(renderer.create(<Translate id="some-id" />).toJSON()).toBe( - 'some-id', - ); + it('loads and displays greeting', async () => { + const {container} = render(<Translate id="some-id" />); + expect(container).toHaveTextContent('some-id'); }); it('accepts message and uses it as fallback', () => { - expect(renderer.create(<Translate>some-message</Translate>).toJSON()).toBe( - 'some-message', - ); + const {container} = render(<Translate>some-message</Translate>); + expect(container).toHaveTextContent('some-message'); }); it('accepts id+message and uses message as fallback', () => { - expect( - renderer - .create(<Translate id="some-id">some-message</Translate>) - .toJSON(), - ).toBe('some-message'); + const {container} = render( + <Translate id="some-id">some-message</Translate>, + ); + expect(container).toHaveTextContent('some-message'); }); it('rejects when no id or message', () => { - expect(() => - // @ts-expect-error: TS should protect when both id/message are missing - renderer.create(<Translate />), - ).toThrowErrorMatchingInlineSnapshot( + expect(() => render(<Translate />)).toThrowErrorMatchingInlineSnapshot( `"Docusaurus translation declarations must have at least a translation id or a default translation message"`, ); }); it('rejects when children is not a string', () => { expect(() => - renderer.create( + render( // eslint-disable-next-line @docusaurus/string-literal-i18n-messages <Translate id="foo"> - {/* @ts-expect-error: for test */} <span>aaa</span> </Translate>, ), diff --git a/packages/docusaurus/src/client/exports/__tests__/__snapshots__/Head.test.tsx.snap b/packages/docusaurus/src/client/exports/__tests__/__snapshots__/Head.test.tsx.snap deleted file mode 100644 index 49af3258a44d..000000000000 --- a/packages/docusaurus/src/client/exports/__tests__/__snapshots__/Head.test.tsx.snap +++ /dev/null @@ -1,38 +0,0 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing - -exports[`Head does exactly what Helmet does 1`] = ` -<div> - Content -</div> -`; - -exports[`Head does exactly what Helmet does 2`] = ` -<html> - <head> - <meta - content="article" - data-rh={true} - property="og:type" - /> - <meta - content="some description overridden" - data-rh={true} - property="og:description" - /> - <meta - content="this property is duplicated" - data-rh={true} - property="duplicated?" - /> - <meta - content="another one" - data-rh={true} - property="duplicated?" - /> - <title - data-rh={true} - /> - </head> - <body /> -</html> -`; diff --git a/packages/docusaurus/src/client/exports/__tests__/__snapshots__/Interpolate.test.tsx.snap b/packages/docusaurus/src/client/exports/__tests__/__snapshots__/Interpolate.test.tsx.snap deleted file mode 100644 index d524f7a3c081..000000000000 --- a/packages/docusaurus/src/client/exports/__tests__/__snapshots__/Interpolate.test.tsx.snap +++ /dev/null @@ -1,55 +0,0 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing - -exports[`<Interpolate> acceptance test 1`] = ` -[ - "Hello ", - "Sébastien", - " how are you ", - <span> - today - </span>, - "? Another ", - "{unprovidedValue}", - "!", -] -`; - -exports[`interpolate acceptance test 1`] = ` -[ - "Hello ", - "Sébastien", - " how are you ", - <span> - today - </span>, - "? Another ", - "{unprovidedValue}", - "!", -] -`; - -exports[`interpolate placeholders with JSX values 1`] = ` -[ - "Hello ", - <b> - Sébastien - </b>, - " how are you ", - <span> - today - </span>, - "?", -] -`; - -exports[`interpolate placeholders with mixed vales 1`] = ` -[ - "Hello ", - "Sébastien", - " how are you ", - <span> - today - </span>, - "?", -] -`; diff --git a/packages/docusaurus/src/client/exports/__tests__/useBaseUrl.test.tsx b/packages/docusaurus/src/client/exports/__tests__/useBaseUrl.test.tsx index babbadbe05d8..fb6009000835 100644 --- a/packages/docusaurus/src/client/exports/__tests__/useBaseUrl.test.tsx +++ b/packages/docusaurus/src/client/exports/__tests__/useBaseUrl.test.tsx @@ -3,10 +3,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import React from 'react'; -import {renderHook} from '@testing-library/react-hooks'; +import {renderHook} from '@testing-library/react'; import {fromPartial} from '@total-typescript/shoehorn'; import useBaseUrl, {addBaseUrl, useBaseUrlUtils} from '../useBaseUrl'; import {Context} from '../../docusaurusContext'; diff --git a/packages/docusaurus/src/client/exports/__tests__/useGlobalData.test.tsx b/packages/docusaurus/src/client/exports/__tests__/useGlobalData.test.tsx index 38bee47f6001..7269a8eb7a83 100644 --- a/packages/docusaurus/src/client/exports/__tests__/useGlobalData.test.tsx +++ b/packages/docusaurus/src/client/exports/__tests__/useGlobalData.test.tsx @@ -3,10 +3,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import React from 'react'; -import {renderHook} from '@testing-library/react-hooks'; +import {renderHook} from '@testing-library/react'; import useGlobalData, { useAllPluginInstancesData, usePluginData, diff --git a/packages/docusaurus/src/client/exports/__tests__/useRouteContext.test.tsx b/packages/docusaurus/src/client/exports/__tests__/useRouteContext.test.tsx index 61b3bd7231d6..bce83da94ca5 100644 --- a/packages/docusaurus/src/client/exports/__tests__/useRouteContext.test.tsx +++ b/packages/docusaurus/src/client/exports/__tests__/useRouteContext.test.tsx @@ -3,12 +3,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @jest-environment jsdom */ +// Jest doesn't allow pragma below other comments. https://github.com/facebook/jest/issues/12573 +// eslint-disable-next-line header/header import React from 'react'; -// TODO migrate to @testing-library/react when SSR rendering possible -// See https://github.com/testing-library/react-testing-library/issues/1120 -import {renderHook} from '@testing-library/react-hooks/server'; +import {renderHook} from '@testing-library/react'; import {RouteContextProvider} from '../../routeContext'; import useRouteContext from '../useRouteContext'; diff --git a/yarn.lock b/yarn.lock index 78846954ba35..4dc3dbb9f7e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@adobe/css-tools@^4.4.0": + version "4.4.4" + resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.4.4.tgz#2856c55443d3d461693f32d2b96fb6ea92e1ffa9" + integrity sha512-Elp+iwUx5rN5+Y8xLt5/GRoG20WGoDCQ/1Fb+1LiGtvwbDavuSk0jhD/eZdckHAuzcDzccnkv+rEjyWfRx18gg== + "@ai-sdk/gateway@1.0.29": version "1.0.29" resolved "https://registry.yarnpkg.com/@ai-sdk/gateway/-/gateway-1.0.29.tgz#b7e902c2d7139e2ca2a94cb6076febe517088fa0" @@ -262,7 +267,7 @@ "@babel/highlight" "^7.25.7" picocolors "^1.0.0" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.27.1", "@babel/code-frame@^7.28.6": +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.27.1", "@babel/code-frame@^7.28.6": version "7.28.6" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.28.6.tgz#72499312ec58b1e2245ba4a4f550c132be4982f7" integrity sha512-JYgintcMjRiCvS8mMECzaEn+m3PfoQiyqukOMCCVQtoJGYJw8j/8LBJEiqkHLkfwCcs74E3pbAUFNg7d9VNJ+Q== @@ -3954,13 +3959,38 @@ dependencies: defer-to-connect "^2.0.1" -"@testing-library/react-hooks@^8.0.1": - version "8.0.1" - resolved "https://registry.yarnpkg.com/@testing-library/react-hooks/-/react-hooks-8.0.1.tgz#0924bbd5b55e0c0c0502d1754657ada66947ca12" - integrity sha512-Aqhl2IVmLt8IovEVarNDFuJDVWVvhnr9/GCU6UUnrYXwgDFF9h2L2o2P9KBni1AST5sT6riAyoukFLyjQUgD/g== +"@testing-library/dom@^10.4.1": + version "10.4.1" + resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-10.4.1.tgz#d444f8a889e9a46e9a3b4f3b88e0fcb3efb6cf95" + integrity sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg== + dependencies: + "@babel/code-frame" "^7.10.4" + "@babel/runtime" "^7.12.5" + "@types/aria-query" "^5.0.1" + aria-query "5.3.0" + dom-accessibility-api "^0.5.9" + lz-string "^1.5.0" + picocolors "1.1.1" + pretty-format "^27.0.2" + +"@testing-library/jest-dom@^6.9.1": + version "6.9.1" + resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-6.9.1.tgz#7613a04e146dd2976d24ddf019730d57a89d56c2" + integrity sha512-zIcONa+hVtVSSep9UT3jZ5rizo2BsxgyDYU7WFD5eICBE7no3881HGeb/QkGfsJs6JTkY1aQhT7rIPC7e+0nnA== + dependencies: + "@adobe/css-tools" "^4.4.0" + aria-query "^5.0.0" + css.escape "^1.5.1" + dom-accessibility-api "^0.6.3" + picocolors "^1.1.1" + redent "^3.0.0" + +"@testing-library/react@^16.3.2": + version "16.3.2" + resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-16.3.2.tgz#672883b7acb8e775fc0492d9e9d25e06e89786d0" + integrity sha512-XU5/SytQM+ykqMnAnvB2umaJNIOsLF3PVv//1Ew4CTcpz0/BRyy/af40qqrt7SjKpDdT1saBMc42CUok5gaw+g== dependencies: "@babel/runtime" "^7.12.5" - react-error-boundary "^3.1.0" "@tootallnate/once@1": version "1.1.2" @@ -4009,6 +4039,11 @@ dependencies: "@types/estree" "*" +"@types/aria-query@^5.0.1": + version "5.0.4" + resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.4.tgz#1a31c3d378850d2778dabb6374d036dcba4ba708" + integrity sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw== + "@types/babel__core@^7.20.5": version "7.20.5" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" @@ -4682,12 +4717,10 @@ resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb" integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== -"@types/react-dom@^18.2.7": - version "18.3.1" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.3.1.tgz#1e4654c08a9cdcfb6594c780ac59b55aad42fe07" - integrity sha512-qW1Mfv8taImTthu4KoXgDfLuk4bydU6Q/TkADnDWWHwi4NX4BR+LWfTp2sVmTqRrsHvyDDTelgelxJ+SsejKKQ== - dependencies: - "@types/react" "*" +"@types/react-dom@^19.2.3": + version "19.2.3" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-19.2.3.tgz#c1e305d15a52a3e508d54dca770d202cb63abf2c" + integrity sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ== "@types/react-router-config@*", "@types/react-router-config@^5.0.7": version "5.0.11" @@ -4715,13 +4748,6 @@ "@types/history" "^4.7.11" "@types/react" "*" -"@types/react-test-renderer@^18.0.0": - version "18.3.0" - resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-18.3.0.tgz#839502eae70058a4ae161f63385a8e7929cef4c0" - integrity sha512-HW4MuEYxfDbOHQsVlY/XtOvNHftCVEPhJF2pQXXwcUiUF+Oyb0usgp48HSgpK5rt8m9KZb22yqOeZm+rrVG8gw== - dependencies: - "@types/react" "*" - "@types/react@*", "@types/react@^19.0.0", "@types/react@^19.2.10": version "19.2.10" resolved "https://registry.yarnpkg.com/@types/react/-/react-19.2.10.tgz#f3ea799e6b4cebad6dfd231c238fc9de7652e2d2" @@ -5570,7 +5596,14 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -aria-query@^5.3.2: +aria-query@5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.3.0.tgz#650c569e41ad90b51b3d7df5e5eed1c7549c103e" + integrity sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A== + dependencies: + dequal "^2.0.3" + +aria-query@^5.0.0, aria-query@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.3.2.tgz#93f81a43480e33a338f19163a3d10a50c01dcd59" integrity sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw== @@ -7356,6 +7389,11 @@ css-what@^6.0.1, css-what@^6.1.0: resolved "https://registry.yarnpkg.com/css-what/-/css-what-6.1.0.tgz#fb5effcf76f1ddea2c81bdfaa4de44e79bac70f4" integrity sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw== +css.escape@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/css.escape/-/css.escape-1.5.1.tgz#42e27d4fa04ae32f931a4b4d4191fa9cddee97cb" + integrity sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg== + cssdb@^8.3.0: version "8.3.0" resolved "https://registry.yarnpkg.com/cssdb/-/cssdb-8.3.0.tgz#940becad497b8509ad822a28fb0cfe54c969ccfe" @@ -8080,6 +8118,16 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" +dom-accessibility-api@^0.5.9: + version "0.5.16" + resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz#5a7429e6066eb3664d911e33fb0e45de8eb08453" + integrity sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg== + +dom-accessibility-api@^0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz#993e925cc1d73f2c662e7d75dd5a5445259a8fd8" + integrity sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w== + dom-converter@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.2.0.tgz#6721a9daee2e293682955b6afe416771627bb768" @@ -12413,6 +12461,11 @@ lru-cache@^7.4.4, lru-cache@^7.5.1, lru-cache@^7.7.1: resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.18.3.tgz#f793896e0fd0e954a59dfdd82f0773808df6aa89" integrity sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA== +lz-string@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.5.0.tgz#c1ab50f77887b712621201ba9fd4e3a6ed099941" + integrity sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ== + magic-string@^0.25.0, magic-string@^0.25.2, magic-string@^0.25.7: version "0.25.9" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.9.tgz#de7f9faf91ef8a1c91d02c2e5314c8277dbcdd1c" @@ -14756,7 +14809,7 @@ pend@~1.2.0: resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" integrity sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg== -picocolors@^1.0.0, picocolors@^1.1.1: +picocolors@1.1.1, picocolors@^1.0.0, picocolors@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== @@ -15511,6 +15564,15 @@ pretty-format@30.2.0, pretty-format@^30.0.0: ansi-styles "^5.2.0" react-is "^18.3.1" +pretty-format@^27.0.2: + version "27.5.1" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.5.1.tgz#2181879fdea51a7a5851fb39d920faa63f01d88e" + integrity sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ== + dependencies: + ansi-regex "^5.0.1" + ansi-styles "^5.0.0" + react-is "^17.0.1" + pretty-format@^29.0.0, pretty-format@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" @@ -15755,27 +15817,12 @@ react-dom@16.14.0: prop-types "^15.6.2" scheduler "^0.19.1" -react-dom@^18.0.0: - version "18.3.1" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.1.tgz#c2265d79511b57d479b3dd3fdfa51536494c5cb4" - integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw== - dependencies: - loose-envify "^1.1.0" - scheduler "^0.23.2" - -react-dom@^19.0.0: - version "19.0.0" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-19.0.0.tgz#43446f1f01c65a4cd7f7588083e686a6726cfb57" - integrity sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ== +react-dom@^19.0.0, react-dom@^19.2.4: + version "19.2.4" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-19.2.4.tgz#6fac6bd96f7db477d966c7ec17c1a2b1ad8e6591" + integrity sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ== dependencies: - scheduler "^0.25.0" - -react-error-boundary@^3.1.0: - version "3.1.4" - resolved "https://registry.yarnpkg.com/react-error-boundary/-/react-error-boundary-3.1.4.tgz#255db92b23197108757a888b01e5b729919abde0" - integrity sha512-uM9uPzZJTF6wRQORmSrvOIgt4lJ9MC1sNgEOj2XGsDTRE4kmpWxg7ENK9EWNKJRMAOY9z0MuF4yIfl6gp4sotA== - dependencies: - "@babel/runtime" "^7.12.5" + scheduler "^0.27.0" react-fast-compare@^3.2.0: version "3.2.2" @@ -15793,16 +15840,16 @@ react-fast-compare@^3.2.0: react-fast-compare "^3.2.0" shallowequal "^1.1.0" -"react-is@^16.12.0 || ^17.0.0 || ^18.0.0", react-is@^18.0.0, react-is@^18.3.1: - version "18.3.1" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" - integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== - react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== +react-is@^17.0.1, react-is@^18.0.0, react-is@^18.3.1, react-is@^19.2.4: + version "19.2.4" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-19.2.4.tgz#a080758243c572ccd4a63386537654298c99d135" + integrity sha512-W+EWGn2v0ApPKgKKCy/7s7WHXkboGcsrXE+2joLyVxkbyVQfO3MUEaUQDHoSmb8TFFrSKYa9mw64WZHNHSDzYA== + react-json-view-lite@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/react-json-view-lite/-/react-json-view-lite-2.3.0.tgz#872e36202c00711bf3f8582e0ae6c5cf63bbaac0" @@ -15876,23 +15923,6 @@ react-router@5.3.4, react-router@^5.3.4: tiny-invariant "^1.0.2" tiny-warning "^1.0.0" -react-shallow-renderer@^16.15.0: - version "16.15.0" - resolved "https://registry.yarnpkg.com/react-shallow-renderer/-/react-shallow-renderer-16.15.0.tgz#48fb2cf9b23d23cde96708fe5273a7d3446f4457" - integrity sha512-oScf2FqQ9LFVQgA73vr86xl2NaOIX73rh+YFqcOp68CWj56tSfgtGKrEbyhCj0rSijyG9M1CYprTh39fBi5hzA== - dependencies: - object-assign "^4.1.1" - react-is "^16.12.0 || ^17.0.0 || ^18.0.0" - -react-test-renderer@^18.0.0: - version "18.3.1" - resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-18.3.1.tgz#e693608a1f96283400d4a3afead6893f958b80b4" - integrity sha512-KkAgygexHUkQqtvvx/otwxtuFu5cVjfzTCtjXLH9boS19/Nbtg84zS7wIQn39G8IlrhThBpQsMKkq5ZHZIYFXA== - dependencies: - react-is "^18.3.1" - react-shallow-renderer "^16.15.0" - scheduler "^0.23.2" - react@16.14.0: version "16.14.0" resolved "https://registry.yarnpkg.com/react/-/react-16.14.0.tgz#94d776ddd0aaa37da3eda8fc5b6b18a4c9a3114d" @@ -15902,17 +15932,10 @@ react@16.14.0: object-assign "^4.1.1" prop-types "^15.6.2" -react@^18.0.0: - version "18.3.1" - resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891" - integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ== - dependencies: - loose-envify "^1.1.0" - -react@^19.0.0: - version "19.0.0" - resolved "https://registry.yarnpkg.com/react/-/react-19.0.0.tgz#6e1969251b9f108870aa4bff37a0ce9ddfaaabdd" - integrity sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ== +react@^19.0.0, react@^19.2.4: + version "19.2.4" + resolved "https://registry.yarnpkg.com/react/-/react-19.2.4.tgz#438e57baa19b77cb23aab516cf635cd0579ee09a" + integrity sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ== read-cmd-shim@3.0.0: version "3.0.0" @@ -16657,17 +16680,10 @@ scheduler@^0.19.1: loose-envify "^1.1.0" object-assign "^4.1.1" -scheduler@^0.23.2: - version "0.23.2" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.2.tgz#414ba64a3b282892e944cf2108ecc078d115cdc3" - integrity sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ== - dependencies: - loose-envify "^1.1.0" - -scheduler@^0.25.0: - version "0.25.0" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.25.0.tgz#336cd9768e8cceebf52d3c80e3dcf5de23e7e015" - integrity sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA== +scheduler@^0.27.0: + version "0.27.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.27.0.tgz#0c4ef82d67d1e5c1e359e8fc76d3a87f045fe5bd" + integrity sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q== schema-dts@^1.1.2: version "1.1.2"