diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 46c97b328..1c26ec655 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -34,5 +34,5 @@ labels: 'bug report' diff --git a/.yarnrc.yml b/.yarnrc.yml index 4a8eb27e3..9bbe01613 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -5,7 +5,7 @@ npmMinimalAgeGate: '3d' npmPreapprovedPackages: - react - react-native - - universal-test-renderer + - test-renderer - '@testing-library/react-native' - '@react-native/*' - '@types/react' diff --git a/AGENTS.md b/AGENTS.md index e5f63d967..52cde746f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,7 +8,7 @@ This document provides context for the any code assistant to understand the `@te - **Core Principle:** "The more your tests resemble the way your software is used, the more confidence they can give you." - **Tech Stack:** TypeScript, React Native, Jest. -- **Architecture:** The library simulates the React Native runtime on top of `universal-test-renderer`. +- **Architecture:** The library simulates the React Native runtime on top of `test-renderer`. ## Project Guidelines diff --git a/README.md b/README.md index 8cbe0e8fc..26fd0dc15 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ You want to write maintainable tests for your React Native components. As a part ## This solution -The React Native Testing Library (RNTL) is a comprehensive solution for testing React Native components. It provides React Native runtime simulation on top of `universal-test-renderer`, in a way that encourages better testing practices. Its primary guiding principle is: +The React Native Testing Library (RNTL) is a comprehensive solution for testing React Native components. It provides React Native runtime simulation on top of `test-renderer`, in a way that encourages better testing practices. Its primary guiding principle is: > The more your tests resemble the way your software is used, the more confidence they can give you. @@ -36,7 +36,7 @@ yarn add --dev @testing-library/react-native npm install --save-dev @testing-library/react-native ``` -This library has a `peerDependencies` listing for `universal-test-renderer`. Make sure that your `universal-test-renderer` version matches exactly the `react` version, avoid using `^` in version number. +This library has a `peerDependencies` listing for `test-renderer`. Make sure that your `test-renderer` version matches exactly the `react` version, avoid using `^` in version number. ### Additional Jest matchers diff --git a/codemods/v14-update-deps/README.md b/codemods/v14-update-deps/README.md index 4600a0180..96fe4d821 100644 --- a/codemods/v14-update-deps/README.md +++ b/codemods/v14-update-deps/README.md @@ -7,7 +7,7 @@ This codemod automatically updates your `package.json` to prepare for React Nati - Removes `@types/react-test-renderer` and `react-test-renderer` (no longer needed) - Moves `@testing-library/react-native` to `devDependencies` if it's in `dependencies` - Updates `@testing-library/react-native` to `^14.0.0-alpha.5` -- Adds `universal-test-renderer@0.10.1` to `devDependencies` +- Adds `test-renderer@0.12.0` to `devDependencies` ## Usage @@ -38,7 +38,7 @@ npx codemod@latest run rntl-v14-update-deps --target ./path/to/your/project { "devDependencies": { "@testing-library/react-native": "^14.0.0-alpha.5", - "universal-test-renderer": "0.10.1" + "test-renderer": "0.12.0" } } ``` diff --git a/codemods/v14-update-deps/scripts/codemod.ts b/codemods/v14-update-deps/scripts/codemod.ts index e9c859333..a03af46a4 100644 --- a/codemods/v14-update-deps/scripts/codemod.ts +++ b/codemods/v14-update-deps/scripts/codemod.ts @@ -4,7 +4,7 @@ import type { Transform } from 'codemod:ast-grep'; import type JSONLang from 'codemod:ast-grep/langs/json'; const RNTL_VERSION = '^14.0.0-alpha.5'; -const UNIVERSAL_TEST_RENDERER_VERSION = '0.10.1'; +const TEST_RENDERER_VERSION = '0.12.0'; interface PackageJson { dependencies?: Record; @@ -27,7 +27,7 @@ export default async function transform( const content = root.root().text(); const packageJson: PackageJson = JSON.parse(content); - if (!hasRNTLOrUTR(packageJson)) { + if (!hasRntlOrTestRenderer(packageJson)) { return null; } @@ -41,11 +41,11 @@ export default async function transform( hasChanges = true; } - if (ensureRNTLInDevDependencies(packageJson)) { + if (ensureRntlInDevDependencies(packageJson)) { hasChanges = true; } - if (updateUTRVersionInDevDependencies(packageJson)) { + if (updateTestRendererVersionInDevDependencies(packageJson)) { hasChanges = true; } @@ -67,18 +67,18 @@ function isPackageJsonFile(filename: string): boolean { return filename.endsWith('package.json'); } -function hasRNTLOrUTR(packageJson: PackageJson): boolean { - const hasRNTL = +function hasRntlOrTestRenderer(packageJson: PackageJson): boolean { + const hasRntl = packageJson.dependencies?.['@testing-library/react-native'] || packageJson.devDependencies?.['@testing-library/react-native'] || packageJson.peerDependencies?.['@testing-library/react-native']; - const hasUTR = - packageJson.dependencies?.['universal-test-renderer'] || - packageJson.devDependencies?.['universal-test-renderer'] || - packageJson.peerDependencies?.['universal-test-renderer']; + const hasTestRenderer = + packageJson.dependencies?.['test-renderer'] || + packageJson.devDependencies?.['test-renderer'] || + packageJson.peerDependencies?.['test-renderer']; - return hasRNTL || hasUTR; + return hasRntl || hasTestRenderer; } function removePackageFromAllDependencyTypes(pkgName: string, packageJson: PackageJson): boolean { @@ -121,7 +121,7 @@ function removeObsoletePackages(packageJson: PackageJson): boolean { return removedTypes || removedRenderer; } -function ensureRNTLInDevDependencies(packageJson: PackageJson): boolean { +function ensureRntlInDevDependencies(packageJson: PackageJson): boolean { let hasChanges = false; const rntlInDeps = packageJson.dependencies?.['@testing-library/react-native']; @@ -140,10 +140,10 @@ function ensureRNTLInDevDependencies(packageJson: PackageJson): boolean { return hasChanges; } -function updateUTRVersionInDevDependencies(packageJson: PackageJson): boolean { - const currentVersion = packageJson.devDependencies?.['universal-test-renderer']; - if (currentVersion !== UNIVERSAL_TEST_RENDERER_VERSION) { - packageJson.devDependencies!['universal-test-renderer'] = UNIVERSAL_TEST_RENDERER_VERSION; +function updateTestRendererVersionInDevDependencies(packageJson: PackageJson): boolean { + const currentVersion = packageJson.devDependencies?.['test-renderer']; + if (currentVersion !== TEST_RENDERER_VERSION) { + packageJson.devDependencies!['test-renderer'] = TEST_RENDERER_VERSION; return true; } return false; diff --git a/codemods/v14-update-deps/tests/fixtures/already-alpha/expected.json b/codemods/v14-update-deps/tests/fixtures/already-alpha/expected.json index 0f4787f02..3636b3a68 100644 --- a/codemods/v14-update-deps/tests/fixtures/already-alpha/expected.json +++ b/codemods/v14-update-deps/tests/fixtures/already-alpha/expected.json @@ -3,6 +3,6 @@ "version": "1.0.0", "devDependencies": { "@testing-library/react-native": "^14.0.0-alpha.5", - "universal-test-renderer": "0.10.1" + "test-renderer": "0.12.0" } } diff --git a/codemods/v14-update-deps/tests/fixtures/basic-update/expected.json b/codemods/v14-update-deps/tests/fixtures/basic-update/expected.json index 0f4787f02..3636b3a68 100644 --- a/codemods/v14-update-deps/tests/fixtures/basic-update/expected.json +++ b/codemods/v14-update-deps/tests/fixtures/basic-update/expected.json @@ -3,6 +3,6 @@ "version": "1.0.0", "devDependencies": { "@testing-library/react-native": "^14.0.0-alpha.5", - "universal-test-renderer": "0.10.1" + "test-renderer": "0.12.0" } } diff --git a/codemods/v14-update-deps/tests/fixtures/move-from-deps/expected.json b/codemods/v14-update-deps/tests/fixtures/move-from-deps/expected.json index 0f4787f02..3636b3a68 100644 --- a/codemods/v14-update-deps/tests/fixtures/move-from-deps/expected.json +++ b/codemods/v14-update-deps/tests/fixtures/move-from-deps/expected.json @@ -3,6 +3,6 @@ "version": "1.0.0", "devDependencies": { "@testing-library/react-native": "^14.0.0-alpha.5", - "universal-test-renderer": "0.10.1" + "test-renderer": "0.12.0" } } diff --git a/codemods/v14-update-deps/tests/fixtures/rntl-in-devdeps/expected.json b/codemods/v14-update-deps/tests/fixtures/rntl-in-devdeps/expected.json index 1928868ae..009774ae5 100644 --- a/codemods/v14-update-deps/tests/fixtures/rntl-in-devdeps/expected.json +++ b/codemods/v14-update-deps/tests/fixtures/rntl-in-devdeps/expected.json @@ -1,6 +1,6 @@ { "devDependencies": { "@testing-library/react-native": "^14.0.0-alpha.5", - "universal-test-renderer": "0.10.1" + "test-renderer": "0.12.0" } } diff --git a/codemods/v14-update-deps/tests/fixtures/with-peer-deps/expected.json b/codemods/v14-update-deps/tests/fixtures/with-peer-deps/expected.json index 0f4787f02..3636b3a68 100644 --- a/codemods/v14-update-deps/tests/fixtures/with-peer-deps/expected.json +++ b/codemods/v14-update-deps/tests/fixtures/with-peer-deps/expected.json @@ -3,6 +3,6 @@ "version": "1.0.0", "devDependencies": { "@testing-library/react-native": "^14.0.0-alpha.5", - "universal-test-renderer": "0.10.1" + "test-renderer": "0.12.0" } } diff --git a/package.json b/package.json index 4c0cfd6ef..d3f818dce 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "jest": ">=29.0.0", "react": ">=19.0.0", "react-native": ">=0.78", - "universal-test-renderer": "~0.10.1" + "test-renderer": "~0.10.1" }, "peerDependenciesMeta": { "jest": { @@ -91,9 +91,9 @@ "react-native": "0.83.1", "react-native-gesture-handler": "^2.29.1", "release-it": "^19.0.6", + "test-renderer": "0.12.0", "typescript": "^5.9.3", - "typescript-eslint": "^8.47.0", - "universal-test-renderer": "0.10.1" + "typescript-eslint": "^8.47.0" }, "publishConfig": { "registry": "https://registry.npmjs.org" diff --git a/src/__tests__/render.test.tsx b/src/__tests__/render.test.tsx index 97cd6c732..cef099f9d 100644 --- a/src/__tests__/render.test.tsx +++ b/src/__tests__/render.test.tsx @@ -70,3 +70,15 @@ test('unmount function unmounts component asynchronously', async () => { await screen.unmount(); expect(fn).toHaveBeenCalled(); }); + +test('render accepts RCTText component', async () => { + await render(React.createElement('RCTText', { testID: 'text' }, 'Hello')); + expect(screen.getByTestId('text')).toBeOnTheScreen(); + expect(screen.getByText('Hello')).toBeOnTheScreen(); +}); + +test('render throws when text string is rendered without Text component', async () => { + await expect(render(Hello)).rejects.toThrowErrorMatchingInlineSnapshot( + `"Invariant Violation: Text strings must be rendered within a component. Detected attempt to render "Hello" string within a component."`, + ); +}); diff --git a/src/fire-event.ts b/src/fire-event.ts index e5d428e94..c069c7944 100644 --- a/src/fire-event.ts +++ b/src/fire-event.ts @@ -5,7 +5,7 @@ import type { TextProps, ViewProps, } from 'react-native'; -import type { Fiber, HostElement } from 'universal-test-renderer'; +import type { Fiber, HostElement } from 'test-renderer'; import { act, unsafe_act } from './act'; import type { EventHandler } from './event-handler'; diff --git a/src/helpers/accessibility.ts b/src/helpers/accessibility.ts index f0b792dea..02f5d7ee9 100644 --- a/src/helpers/accessibility.ts +++ b/src/helpers/accessibility.ts @@ -1,6 +1,6 @@ import type { AccessibilityRole, AccessibilityState, AccessibilityValue, Role } from 'react-native'; import { StyleSheet } from 'react-native'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { getContainerElement, getHostSiblings, isHostElement } from './component-tree'; import { findAll } from './find-all'; diff --git a/src/helpers/component-tree.ts b/src/helpers/component-tree.ts index 651ed4fe7..30f6a4e73 100644 --- a/src/helpers/component-tree.ts +++ b/src/helpers/component-tree.ts @@ -1,4 +1,4 @@ -import type { HostElement, HostNode } from 'universal-test-renderer'; +import type { HostElement, HostNode } from 'test-renderer'; import { screen } from '../screen'; diff --git a/src/helpers/debug.ts b/src/helpers/debug.ts index f58016d79..a3b02f760 100644 --- a/src/helpers/debug.ts +++ b/src/helpers/debug.ts @@ -1,4 +1,4 @@ -import type { JsonNode } from 'universal-test-renderer'; +import type { JsonNode } from 'test-renderer'; import type { FormatElementOptions } from './format-element'; import { formatJson } from './format-element'; diff --git a/src/helpers/find-all.ts b/src/helpers/find-all.ts index e18944c52..00389e159 100644 --- a/src/helpers/find-all.ts +++ b/src/helpers/find-all.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { getConfig } from '../config'; import { isHiddenFromAccessibility } from './accessibility'; diff --git a/src/helpers/format-element.ts b/src/helpers/format-element.ts index b917fc6ef..4dd33e4a3 100644 --- a/src/helpers/format-element.ts +++ b/src/helpers/format-element.ts @@ -1,6 +1,6 @@ import type { NewPlugin } from 'pretty-format'; import prettyFormat, { plugins } from 'pretty-format'; -import type { HostElement, JsonNode } from 'universal-test-renderer'; +import type { HostElement, JsonNode } from 'test-renderer'; import type { MapPropsFunction } from './map-props'; import { defaultMapProps } from './map-props'; diff --git a/src/helpers/host-component-names.ts b/src/helpers/host-component-names.ts index 39dc31925..4a25eae7d 100644 --- a/src/helpers/host-component-names.ts +++ b/src/helpers/host-component-names.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; export const HOST_TEXT_NAMES = ['Text', 'RCTText']; const HOST_TEXT_INPUT_NAMES = ['TextInput']; diff --git a/src/helpers/matchers/match-accessibility-state.ts b/src/helpers/matchers/match-accessibility-state.ts index 9cf1be21d..896cdb1ea 100644 --- a/src/helpers/matchers/match-accessibility-state.ts +++ b/src/helpers/matchers/match-accessibility-state.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { computeAriaBusy, diff --git a/src/helpers/matchers/match-accessibility-value.ts b/src/helpers/matchers/match-accessibility-value.ts index 9e332f49f..24141f205 100644 --- a/src/helpers/matchers/match-accessibility-value.ts +++ b/src/helpers/matchers/match-accessibility-value.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import type { TextMatch } from '../../matches'; import { computeAriaValue } from '../accessibility'; diff --git a/src/helpers/matchers/match-label-text.ts b/src/helpers/matchers/match-label-text.ts index b30197892..22070d12a 100644 --- a/src/helpers/matchers/match-label-text.ts +++ b/src/helpers/matchers/match-label-text.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import type { TextMatch, TextMatchOptions } from '../../matches'; import { matches } from '../../matches'; diff --git a/src/helpers/matchers/match-text-content.ts b/src/helpers/matchers/match-text-content.ts index b193f6d25..8cc9d759f 100644 --- a/src/helpers/matchers/match-text-content.ts +++ b/src/helpers/matchers/match-text-content.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import type { TextMatch, TextMatchOptions } from '../../matches'; import { matches } from '../../matches'; diff --git a/src/helpers/pointer-events.ts b/src/helpers/pointer-events.ts index 1e19526bc..e7114c15a 100644 --- a/src/helpers/pointer-events.ts +++ b/src/helpers/pointer-events.ts @@ -1,5 +1,5 @@ import { StyleSheet } from 'react-native'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; /** * pointerEvents controls whether the View can be the target of touch events. diff --git a/src/helpers/text-content.ts b/src/helpers/text-content.ts index 208160d35..aa6277935 100644 --- a/src/helpers/text-content.ts +++ b/src/helpers/text-content.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; export function getTextContent(element: HostElement | string | null): string { if (!element) { diff --git a/src/helpers/text-input.ts b/src/helpers/text-input.ts index 29fa000b3..e33b78d89 100644 --- a/src/helpers/text-input.ts +++ b/src/helpers/text-input.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { nativeState } from '../native-state'; import { isHostTextInput } from './host-component-names'; diff --git a/src/matchers/to-be-busy.ts b/src/matchers/to-be-busy.ts index 969c99c6c..b86dab015 100644 --- a/src/matchers/to-be-busy.ts +++ b/src/matchers/to-be-busy.ts @@ -1,6 +1,6 @@ import { matcherHint } from 'jest-matcher-utils'; import redent from 'redent'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { computeAriaBusy } from '../helpers/accessibility'; import { formatElement } from '../helpers/format-element'; diff --git a/src/matchers/to-be-checked.ts b/src/matchers/to-be-checked.ts index 0dcdb1d06..1d164ec70 100644 --- a/src/matchers/to-be-checked.ts +++ b/src/matchers/to-be-checked.ts @@ -1,6 +1,6 @@ import { matcherHint } from 'jest-matcher-utils'; import redent from 'redent'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { computeAriaChecked, diff --git a/src/matchers/to-be-disabled.ts b/src/matchers/to-be-disabled.ts index 3640a2938..8ab740069 100644 --- a/src/matchers/to-be-disabled.ts +++ b/src/matchers/to-be-disabled.ts @@ -1,6 +1,6 @@ import { matcherHint } from 'jest-matcher-utils'; import redent from 'redent'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { computeAriaDisabled } from '../helpers/accessibility'; import { formatElement } from '../helpers/format-element'; diff --git a/src/matchers/to-be-empty-element.ts b/src/matchers/to-be-empty-element.ts index c8d6946d6..37cfae145 100644 --- a/src/matchers/to-be-empty-element.ts +++ b/src/matchers/to-be-empty-element.ts @@ -1,6 +1,6 @@ import { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils'; import redent from 'redent'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { isHostElement } from '../helpers/component-tree'; import { formatElementList } from '../helpers/format-element'; diff --git a/src/matchers/to-be-expanded.ts b/src/matchers/to-be-expanded.ts index 632e872f4..66a72e09f 100644 --- a/src/matchers/to-be-expanded.ts +++ b/src/matchers/to-be-expanded.ts @@ -1,6 +1,6 @@ import { matcherHint } from 'jest-matcher-utils'; import redent from 'redent'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { computeAriaExpanded } from '../helpers/accessibility'; import { formatElement } from '../helpers/format-element'; diff --git a/src/matchers/to-be-on-the-screen.ts b/src/matchers/to-be-on-the-screen.ts index 76c0682cf..181a701e8 100644 --- a/src/matchers/to-be-on-the-screen.ts +++ b/src/matchers/to-be-on-the-screen.ts @@ -1,6 +1,6 @@ import { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils'; import redent from 'redent'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { getContainerElement } from '../helpers/component-tree'; import { formatElement } from '../helpers/format-element'; diff --git a/src/matchers/to-be-partially-checked.ts b/src/matchers/to-be-partially-checked.ts index 166faa703..68ed2f9f5 100644 --- a/src/matchers/to-be-partially-checked.ts +++ b/src/matchers/to-be-partially-checked.ts @@ -1,6 +1,6 @@ import { matcherHint } from 'jest-matcher-utils'; import redent from 'redent'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { computeAriaChecked, getRole, isAccessibilityElement } from '../helpers/accessibility'; import { ErrorWithStack } from '../helpers/errors'; diff --git a/src/matchers/to-be-selected.ts b/src/matchers/to-be-selected.ts index 834d642e2..71cf822a8 100644 --- a/src/matchers/to-be-selected.ts +++ b/src/matchers/to-be-selected.ts @@ -1,6 +1,6 @@ import { matcherHint } from 'jest-matcher-utils'; import redent from 'redent'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { computeAriaSelected } from '../helpers/accessibility'; import { formatElement } from '../helpers/format-element'; diff --git a/src/matchers/to-be-visible.ts b/src/matchers/to-be-visible.ts index c0655bf22..f5a08a109 100644 --- a/src/matchers/to-be-visible.ts +++ b/src/matchers/to-be-visible.ts @@ -1,7 +1,7 @@ import { StyleSheet } from 'react-native'; import { matcherHint } from 'jest-matcher-utils'; import redent from 'redent'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { isHiddenFromAccessibility } from '../helpers/accessibility'; import { formatElement } from '../helpers/format-element'; diff --git a/src/matchers/to-contain-element.ts b/src/matchers/to-contain-element.ts index b70891f70..651934d52 100644 --- a/src/matchers/to-contain-element.ts +++ b/src/matchers/to-contain-element.ts @@ -1,6 +1,6 @@ import { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils'; import redent from 'redent'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { formatElement } from '../helpers/format-element'; import { checkHostElement } from './utils'; diff --git a/src/matchers/to-have-accessibility-value.ts b/src/matchers/to-have-accessibility-value.ts index eff8b4edf..86c151266 100644 --- a/src/matchers/to-have-accessibility-value.ts +++ b/src/matchers/to-have-accessibility-value.ts @@ -1,5 +1,5 @@ import { matcherHint, stringify } from 'jest-matcher-utils'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { computeAriaValue } from '../helpers/accessibility'; import type { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value'; diff --git a/src/matchers/to-have-accessible-name.ts b/src/matchers/to-have-accessible-name.ts index 71e09f190..0c629ea05 100644 --- a/src/matchers/to-have-accessible-name.ts +++ b/src/matchers/to-have-accessible-name.ts @@ -1,5 +1,5 @@ import { matcherHint } from 'jest-matcher-utils'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { computeAccessibleName } from '../helpers/accessibility'; import type { TextMatch, TextMatchOptions } from '../matches'; diff --git a/src/matchers/to-have-display-value.ts b/src/matchers/to-have-display-value.ts index e8a3b4496..76d9eab05 100644 --- a/src/matchers/to-have-display-value.ts +++ b/src/matchers/to-have-display-value.ts @@ -1,5 +1,5 @@ import { matcherHint } from 'jest-matcher-utils'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { ErrorWithStack } from '../helpers/errors'; import { isHostTextInput } from '../helpers/host-component-names'; diff --git a/src/matchers/to-have-prop.ts b/src/matchers/to-have-prop.ts index c72ef6cc8..0b12902f8 100644 --- a/src/matchers/to-have-prop.ts +++ b/src/matchers/to-have-prop.ts @@ -1,5 +1,5 @@ import { matcherHint, printExpected, stringify } from 'jest-matcher-utils'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { checkHostElement, formatMessage } from './utils'; diff --git a/src/matchers/to-have-style.ts b/src/matchers/to-have-style.ts index 2bd464c27..e5d304b49 100644 --- a/src/matchers/to-have-style.ts +++ b/src/matchers/to-have-style.ts @@ -1,7 +1,7 @@ import type { ImageStyle, StyleProp, TextStyle, ViewStyle } from 'react-native'; import { StyleSheet } from 'react-native'; import { diff, matcherHint } from 'jest-matcher-utils'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { checkHostElement, formatMessage } from './utils'; diff --git a/src/matchers/to-have-text-content.ts b/src/matchers/to-have-text-content.ts index 381f26169..1e6f98259 100644 --- a/src/matchers/to-have-text-content.ts +++ b/src/matchers/to-have-text-content.ts @@ -1,5 +1,5 @@ import { matcherHint } from 'jest-matcher-utils'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { getTextContent } from '../helpers/text-content'; import type { TextMatch, TextMatchOptions } from '../matches'; diff --git a/src/matchers/types.ts b/src/matchers/types.ts index 0e551fa4f..d8241a93e 100644 --- a/src/matchers/types.ts +++ b/src/matchers/types.ts @@ -1,5 +1,5 @@ import type { StyleProp } from 'react-native'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import type { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value'; import type { TextMatch, TextMatchOptions } from '../matches'; diff --git a/src/matchers/utils.ts b/src/matchers/utils.ts index 66b72861a..b10ef3339 100644 --- a/src/matchers/utils.ts +++ b/src/matchers/utils.ts @@ -7,7 +7,7 @@ import { stringify, } from 'jest-matcher-utils'; import redent from 'redent'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { isHostElement } from '../helpers/component-tree'; diff --git a/src/native-state.ts b/src/native-state.ts index ed0541c9e..6a99b86d5 100644 --- a/src/native-state.ts +++ b/src/native-state.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import type { Point } from './types'; diff --git a/src/queries/display-value.ts b/src/queries/display-value.ts index 36c8e68fd..34e0030a4 100644 --- a/src/queries/display-value.ts +++ b/src/queries/display-value.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { findAll } from '../helpers/find-all'; import { isHostTextInput } from '../helpers/host-component-names'; diff --git a/src/queries/hint-text.ts b/src/queries/hint-text.ts index ef3379c6a..86aedeb0c 100644 --- a/src/queries/hint-text.ts +++ b/src/queries/hint-text.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { findAll } from '../helpers/find-all'; import type { TextMatch, TextMatchOptions } from '../matches'; diff --git a/src/queries/label-text.ts b/src/queries/label-text.ts index 378a0a422..abb2d21e0 100644 --- a/src/queries/label-text.ts +++ b/src/queries/label-text.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { findAll } from '../helpers/find-all'; import { matchAccessibilityLabel } from '../helpers/matchers/match-label-text'; diff --git a/src/queries/make-queries.ts b/src/queries/make-queries.ts index fa2868fc5..7e0daf1b5 100644 --- a/src/queries/make-queries.ts +++ b/src/queries/make-queries.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { ErrorWithStack } from '../helpers/errors'; import { formatJson } from '../helpers/format-element'; diff --git a/src/queries/placeholder-text.ts b/src/queries/placeholder-text.ts index 98c477a78..40d76562c 100644 --- a/src/queries/placeholder-text.ts +++ b/src/queries/placeholder-text.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { findAll } from '../helpers/find-all'; import { isHostTextInput } from '../helpers/host-component-names'; diff --git a/src/queries/role.ts b/src/queries/role.ts index 7f932a7c3..8e199b36d 100644 --- a/src/queries/role.ts +++ b/src/queries/role.ts @@ -1,5 +1,5 @@ import type { AccessibilityRole, Role } from 'react-native'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { accessibilityStateKeys, diff --git a/src/queries/test-id.ts b/src/queries/test-id.ts index 236691f2a..5f029cb3e 100644 --- a/src/queries/test-id.ts +++ b/src/queries/test-id.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { findAll } from '../helpers/find-all'; import type { TextMatch, TextMatchOptions } from '../matches'; diff --git a/src/queries/text.ts b/src/queries/text.ts index 78dd0a8bd..b49bc415c 100644 --- a/src/queries/text.ts +++ b/src/queries/text.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { findAll } from '../helpers/find-all'; import { isHostText } from '../helpers/host-component-names'; diff --git a/src/render.tsx b/src/render.tsx index 6ff86bf73..fefc00058 100644 --- a/src/render.tsx +++ b/src/render.tsx @@ -5,7 +5,7 @@ import { type JsonElement, type Root, type RootOptions, -} from 'universal-test-renderer'; +} from 'test-renderer'; import { act } from './act'; import { addToCleanupQueue } from './cleanup'; @@ -37,7 +37,8 @@ export async function render(element: React.ReactElement, options: RenderO const { wrapper: Wrapper, createNodeMock } = options || {}; const rendererOptions: RootOptions = { - textComponents: HOST_TEXT_NAMES, + textComponentTypes: HOST_TEXT_NAMES, + publicTextComponentTypes: ['Text'], createNodeMock, }; diff --git a/src/screen.ts b/src/screen.ts index 1fa86787a..9a389acde 100644 --- a/src/screen.ts +++ b/src/screen.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import type { RenderResult } from './render'; diff --git a/src/test-utils/json.ts b/src/test-utils/json.ts index 5cfe96560..5b9348834 100644 --- a/src/test-utils/json.ts +++ b/src/test-utils/json.ts @@ -1,4 +1,4 @@ -import type { JsonNode } from 'universal-test-renderer'; +import type { JsonNode } from 'test-renderer'; type JsonPropsMapper = { [key: string]: unknown; diff --git a/src/unsafe-render-sync.tsx b/src/unsafe-render-sync.tsx index 2989492ea..7966cf2a9 100644 --- a/src/unsafe-render-sync.tsx +++ b/src/unsafe-render-sync.tsx @@ -5,7 +5,7 @@ import { type JsonElement, type Root, type RootOptions, -} from 'universal-test-renderer'; +} from 'test-renderer'; import { act, unsafe_act } from './act'; import { addToCleanupQueue } from './cleanup'; @@ -45,7 +45,8 @@ export function renderInternal(component: React.ReactElement, options?: Re const { wrapper: Wrapper, createNodeMock } = options || {}; const rendererOptions: RootOptions = { - textComponents: HOST_TEXT_NAMES, + textComponentTypes: HOST_TEXT_NAMES, + publicTextComponentTypes: ['Text'], createNodeMock, }; diff --git a/src/user-event/clear.ts b/src/user-event/clear.ts index 56abb8423..61f123f7d 100644 --- a/src/user-event/clear.ts +++ b/src/user-event/clear.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { ErrorWithStack } from '../helpers/errors'; import { isHostTextInput } from '../helpers/host-component-names'; diff --git a/src/user-event/index.ts b/src/user-event/index.ts index 1a4860ddd..034fdd9c0 100644 --- a/src/user-event/index.ts +++ b/src/user-event/index.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import type { PressOptions } from './press'; import type { ScrollToOptions } from './scroll'; diff --git a/src/user-event/paste.ts b/src/user-event/paste.ts index 57892f7d6..f869588f5 100644 --- a/src/user-event/paste.ts +++ b/src/user-event/paste.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { ErrorWithStack } from '../helpers/errors'; import { isHostTextInput } from '../helpers/host-component-names'; diff --git a/src/user-event/press/press.ts b/src/user-event/press/press.ts index 6677ac520..6b908f9ad 100644 --- a/src/user-event/press/press.ts +++ b/src/user-event/press/press.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { act } from '../../act'; import { getEventHandlerFromProps } from '../../event-handler'; diff --git a/src/user-event/scroll/scroll-to.ts b/src/user-event/scroll/scroll-to.ts index a45df3c1c..1ac320424 100644 --- a/src/user-event/scroll/scroll-to.ts +++ b/src/user-event/scroll/scroll-to.ts @@ -1,5 +1,5 @@ import { stringify } from 'jest-matcher-utils'; -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { ErrorWithStack } from '../../helpers/errors'; import { isHostScrollView } from '../../helpers/host-component-names'; diff --git a/src/user-event/setup/setup.ts b/src/user-event/setup/setup.ts index 27cb4a51f..dfec333fc 100644 --- a/src/user-event/setup/setup.ts +++ b/src/user-event/setup/setup.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { jestFakeTimersAreEnabled } from '../../helpers/timers'; import { wrapAsync } from '../../helpers/wrap-async'; diff --git a/src/user-event/type/type.ts b/src/user-event/type/type.ts index ec10bf181..4d1d040b3 100644 --- a/src/user-event/type/type.ts +++ b/src/user-event/type/type.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { ErrorWithStack } from '../../helpers/errors'; import { isHostTextInput } from '../../helpers/host-component-names'; diff --git a/src/user-event/utils/dispatch-event.ts b/src/user-event/utils/dispatch-event.ts index 869c21bc7..016f3fa7f 100644 --- a/src/user-event/utils/dispatch-event.ts +++ b/src/user-event/utils/dispatch-event.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { act } from '../../act'; import { getEventHandlerFromProps } from '../../event-handler'; diff --git a/src/within.ts b/src/within.ts index 68f4a1c94..11e8754ca 100644 --- a/src/within.ts +++ b/src/within.ts @@ -1,4 +1,4 @@ -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; import { bindByDisplayValueQueries } from './queries/display-value'; import { bindByHintTextQueries } from './queries/hint-text'; diff --git a/website/docs/14.x/docs/advanced/testing-env.mdx b/website/docs/14.x/docs/advanced/testing-env.mdx index acd597d5d..6fd797c13 100644 --- a/website/docs/14.x/docs/advanced/testing-env.mdx +++ b/website/docs/14.x/docs/advanced/testing-env.mdx @@ -18,11 +18,11 @@ React allows you to write declarative code using JSX, write function or class co When you run your tests in the React Native Testing Library, somewhat contrary to what the name suggests, they are actually **not** using React Native renderer. This is because this renderer needs to be run on an iOS or Android operating system, so it would need to run on a device or simulator. -## Universal Test Renderer +## Test Renderer -Instead, RNTL uses [Universal Test Renderer](https://github.com/mdjastrzebski/universal-test-renderer), a modern, actively maintained renderer that allows rendering to pure JavaScript objects without access to mobile OS and can run in a Node.js environment using Jest (or any other JavaScript test runner). Universal Test Renderer replaces the deprecated `react-test-renderer` package and provides better compatibility with React 19 and improved type safety. +Instead, RNTL uses [Test Renderer](https://github.com/mdjastrzebski/test-renderer), a modern, actively maintained renderer that allows rendering to pure JavaScript objects without access to mobile OS and can run in a Node.js environment using Jest (or any other JavaScript test runner). Test Renderer replaces the deprecated `react-test-renderer` package and provides better compatibility with React 19 and improved type safety. -Using Universal Test Renderer has pros and cons. +Using Test Renderer has pros and cons. Benefits: @@ -41,9 +41,9 @@ It's worth noting that the React Testing Library (web one) works a bit different ## Element tree -Calling the `render()` function creates an element tree. This is done internally by invoking the renderer's `create()` method from Universal Test Renderer. The output tree represents your React Native component tree, and each node of that tree is an "instance" of some React component (to be more precise, each node represents a React fiber, and only class components have instances, while function components store the hook state using fibers). +Calling the `render()` function creates an element tree. This is done internally by invoking the renderer's `create()` method from Test Renderer. The output tree represents your React Native component tree, and each node of that tree is an "instance" of some React component (to be more precise, each node represents a React fiber, and only class components have instances, while function components store the hook state using fibers). -These tree elements are represented by `HostElement` type from Universal Test Renderer: +These tree elements are represented by `HostElement` type from Test Renderer: ```tsx interface HostElement { @@ -56,7 +56,7 @@ interface HostElement { } ``` -For more details, see the [Universal Test Renderer documentation](https://github.com/mdjastrzebski/universal-test-renderer). +For more details, see the [Test Renderer documentation](https://github.com/mdjastrzebski/test-renderer). ## Host and composite components diff --git a/website/docs/14.x/docs/api/render.mdx b/website/docs/14.x/docs/api/render.mdx index bd3b360b1..7c1b7608f 100644 --- a/website/docs/14.x/docs/api/render.mdx +++ b/website/docs/14.x/docs/api/render.mdx @@ -45,11 +45,11 @@ Otherwise, `render` will default to using concurrent rendering used in the React createNodeMock?: (element: React.Element) => unknown, ``` -This option allows you to pass `createNodeMock` option to the renderer's `create()` method in order to allow for custom mock refs. This option is passed through to [Universal Test Renderer](https://github.com/mdjastrzebski/universal-test-renderer). +This option allows you to pass `createNodeMock` option to the renderer's `create()` method in order to allow for custom mock refs. This option is passed through to [Test Renderer](https://github.com/mdjastrzebski/test-renderer). :::note Text string validation -Universal Test Renderer automatically enforces React Native's requirement that text strings must be rendered within a `` component. If you try to render a `string` value under components other than `` (e.g., under ``), it will throw an `Invariant Violation: Text strings must be rendered within a component` error, matching React Native's runtime behavior. +Test Renderer automatically enforces React Native's requirement that text strings must be rendered within a `` component. If you try to render a `string` value under components other than `` (e.g., under ``), it will throw an `Invariant Violation: Text strings must be rendered within a component` error, matching React Native's runtime behavior. This validation is always enabled and cannot be disabled, ensuring your tests accurately reflect how your code will behave in production. diff --git a/website/docs/14.x/docs/api/screen.mdx b/website/docs/14.x/docs/api/screen.mdx index 0d9b9142d..62dca9972 100644 --- a/website/docs/14.x/docs/api/screen.mdx +++ b/website/docs/14.x/docs/api/screen.mdx @@ -148,7 +148,7 @@ Get the rendered component JSON representation, e.g. for snapshot testing. const container: HostElement; ``` -Returns a pseudo-element container whose children are the elements you asked to render. This is the root container element from [Universal Test Renderer](https://github.com/mdjastrzebski/universal-test-renderer). +Returns a pseudo-element container whose children are the elements you asked to render. This is the root container element from [Test Renderer](https://github.com/mdjastrzebski/test-renderer). The `container` is safe to use and provides access to the entire rendered tree. It's useful when you need to query or manipulate the entire rendered output, similar to how `container` works in [React Testing Library](https://testing-library.com/docs/react-testing-library/other#container-1). diff --git a/website/docs/14.x/docs/guides/faq.mdx b/website/docs/14.x/docs/guides/faq.mdx index 005caaa44..9ee8d601c 100644 --- a/website/docs/14.x/docs/guides/faq.mdx +++ b/website/docs/14.x/docs/guides/faq.mdx @@ -8,7 +8,7 @@ React Native Testing Library does not provide an entire React Native runtime sin or iOS simulator/Android emulator to provision the underlying OS and platform APIs. Instead of using React Native renderer, it simulates only the JavaScript part of its runtime -using [Universal Test Renderer](https://github.com/mdjastrzebski/universal-test-renderer) while providing queries +using [Test Renderer](https://github.com/mdjastrzebski/test-renderer) while providing queries and event APIs ([User Event](docs/api/events/user-event), [Fire Event](docs/api/events/fire-event)) that mimicking certain behaviors from the actual runtime. You can learn more about our testing environment [here](docs/advanced/testing-env). diff --git a/website/docs/14.x/docs/guides/troubleshooting.mdx b/website/docs/14.x/docs/guides/troubleshooting.mdx index 1ad97bee2..fbf9b1357 100644 --- a/website/docs/14.x/docs/guides/troubleshooting.mdx +++ b/website/docs/14.x/docs/guides/troubleshooting.mdx @@ -2,17 +2,17 @@ This guide describes common issues found by users when integrating React Native Test Library to their projects: -## Matching React Native, React & Universal Test Renderer versions +## Matching React Native, React & Test Renderer versions Check that you have matching versions of core dependencies: - React Native - React -- Universal Test Renderer (automatically installed with RNTL) +- Test Renderer (automatically installed with RNTL) React Native uses different versioning scheme from React, you can use [React Native Upgrade Helper](https://react-native-community.github.io/upgrade-helper/) to find the correct matching between React Native & React versions. In case you use Expo, run `npx expo install --fix` in your project to validate and install compatible versions of these dependencies. -Universal Test Renderer is automatically managed as a dependency of React Native Testing Library and is compatible with React 18 and React 19. +Test Renderer is automatically managed as a dependency of React Native Testing Library and is compatible with React 18 and React 19. Related issues: [#1061](https://github.com/callstack/react-native-testing-library/issues/1061), [#938](https://github.com/callstack/react-native-testing-library/issues/938), [#920](https://github.com/callstack/react-native-testing-library/issues/920) diff --git a/website/docs/14.x/docs/migration/v14.mdx b/website/docs/14.x/docs/migration/v14.mdx index 503aa7e7d..8f05d0cc4 100644 --- a/website/docs/14.x/docs/migration/v14.mdx +++ b/website/docs/14.x/docs/migration/v14.mdx @@ -4,34 +4,34 @@ This guide describes the migration to React Native Testing Library version 14 fr ## Breaking changes -### Universal Test Renderer replaces React Test Renderer +### Test Renderer replaces React Test Renderer -In v14, React Native Testing Library now uses [Universal Test Renderer](https://github.com/mdjastrzebski/universal-test-renderer) instead of the deprecated `react-test-renderer` package. Universal Test Renderer is a modern, actively maintained alternative that provides better compatibility with React 19 and improved type safety. +In v14, React Native Testing Library now uses [Test Renderer](https://github.com/mdjastrzebski/test-renderer) instead of the deprecated `react-test-renderer` package. Test Renderer is a modern, actively maintained alternative that provides better compatibility with React 19 and improved type safety. **What changed:** -- The underlying rendering engine has been switched from `react-test-renderer` to `universal-test-renderer` +- The underlying rendering engine has been switched from `react-test-renderer` to `test-renderer` - This change is mostly internal and should not require code changes in most cases -- Type definitions have been updated to use `HostElement` from Universal Test Renderer instead of `ReactTestInstance` +- Type definitions have been updated to use `HostElement` from Test Renderer instead of `ReactTestInstance` **Migration:** #### 1. Update dependencies -Remove `react-test-renderer` and its type definitions from your dev dependencies, and add `universal-test-renderer`: +Remove `react-test-renderer` and its type definitions from your dev dependencies, and add `test-renderer`: ```bash # Using npm npm uninstall react-test-renderer @types/react-test-renderer -npm install -D universal-test-renderer@^0.10.0 +npm install -D test-renderer@^0.10.0 # Using yarn yarn remove react-test-renderer @types/react-test-renderer -yarn add -D universal-test-renderer@^0.10.0 +yarn add -D test-renderer@^0.10.0 # Using pnpm pnpm remove react-test-renderer @types/react-test-renderer -pnpm add -D universal-test-renderer@^0.10.0 +pnpm add -D test-renderer@^0.10.0 ``` #### 2. Update type imports (if needed) @@ -43,12 +43,12 @@ If you were directly importing types from `react-test-renderer`, you may need to import type { ReactTestInstance } from 'react-test-renderer'; // After (v14) -import type { HostElement } from 'universal-test-renderer'; +import type { HostElement } from 'test-renderer'; ``` **Note:** Most users won't need to update type imports, as React Native Testing Library now exports the necessary types directly. -For more details, see the [Universal Test Renderer documentation](https://github.com/mdjastrzebski/universal-test-renderer). +For more details, see the [Test Renderer documentation](https://github.com/mdjastrzebski/test-renderer). ### `container` API reintroduced @@ -57,7 +57,7 @@ In v14, the `container` API has been reintroduced and is now safe to use. Previo **What changed:** - `screen.container` is now available and safe to use -- `container` returns a pseudo-element container from Universal Test Renderer +- `container` returns a pseudo-element container from Test Renderer - The container's children are the elements you rendered - `UNSAFE_root` has been removed @@ -499,7 +499,7 @@ it('should press button', () => { ### Text string validation now enforced by default -In v14, Universal Test Renderer automatically enforces React Native's requirement that text strings must be rendered within a `` component. This means the `unstable_validateStringsRenderedWithinText` option has been removed from `RenderOptions`, as this validation is now always enabled. +In v14, Test Renderer automatically enforces React Native's requirement that text strings must be rendered within a `` component. This means the `unstable_validateStringsRenderedWithinText` option has been removed from `RenderOptions`, as this validation is now always enabled. **What changed:** diff --git a/website/docs/14.x/docs/start/intro.md b/website/docs/14.x/docs/start/intro.md index 00bfb76be..391e6098e 100644 --- a/website/docs/14.x/docs/start/intro.md +++ b/website/docs/14.x/docs/start/intro.md @@ -6,7 +6,7 @@ You want to write maintainable tests for your React Native components. As a part ## This solution -The React Native Testing Library (RNTL) is a lightweight solution for testing React Native components. It provides light utility functions on top of [Universal Test Renderer](https://github.com/mdjastrzebski/universal-test-renderer), in a way that encourages better testing practices. Its primary guiding principle is: +The React Native Testing Library (RNTL) is a lightweight solution for testing React Native components. It provides light utility functions on top of [Test Renderer](https://github.com/mdjastrzebski/test-renderer), in a way that encourages better testing practices. Its primary guiding principle is: > The more your tests resemble how your software is used, the more confidence they can give you. diff --git a/website/docs/14.x/docs/start/quick-start.mdx b/website/docs/14.x/docs/start/quick-start.mdx index 4871874d5..116c50d80 100644 --- a/website/docs/14.x/docs/start/quick-start.mdx +++ b/website/docs/14.x/docs/start/quick-start.mdx @@ -13,7 +13,7 @@ Open a Terminal in your project's folder and run: }} /> -This library uses [Universal Test Renderer](https://github.com/mdjastrzebski/universal-test-renderer) as its underlying rendering engine. Universal Test Renderer is automatically installed as a dependency and provides better compatibility with React 19 and improved type safety compared to the deprecated `react-test-renderer` package. +This library uses [Test Renderer](https://github.com/mdjastrzebski/test-renderer) as its underlying rendering engine. Test Renderer is automatically installed as a dependency and provides better compatibility with React 19 and improved type safety compared to the deprecated `react-test-renderer` package. ### Jest matchers diff --git a/yarn.lock b/yarn.lock index 146207210..157736045 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3038,14 +3038,14 @@ __metadata: react-native-gesture-handler: "npm:^2.29.1" redent: "npm:^3.0.0" release-it: "npm:^19.0.6" + test-renderer: "npm:0.12.0" typescript: "npm:^5.9.3" typescript-eslint: "npm:^8.47.0" - universal-test-renderer: "npm:0.10.1" peerDependencies: jest: ">=29.0.0" react: ">=19.0.0" react-native: ">=0.78" - universal-test-renderer: ~0.10.1 + test-renderer: ~0.10.1 peerDependenciesMeta: jest: optional: true @@ -10440,6 +10440,18 @@ __metadata: languageName: node linkType: hard +"test-renderer@npm:0.12.0": + version: 0.12.0 + resolution: "test-renderer@npm:0.12.0" + dependencies: + "@types/react-reconciler": "npm:~0.31.0" + react-reconciler: "npm:~0.31.0" + peerDependencies: + react: ^19.0.0 + checksum: 10c0/a9737762a58bbf7b7a3569fb8b4c44482dac2b7135b17b50080e51e39d87474484574f72c77aef21eecd4b737c3ade1ee4faeb2ac4fa0ee146cbdc8735550b29 + languageName: node + linkType: hard + "throat@npm:^5.0.0": version: 5.0.0 resolution: "throat@npm:5.0.0" @@ -10745,18 +10757,6 @@ __metadata: languageName: node linkType: hard -"universal-test-renderer@npm:0.10.1": - version: 0.10.1 - resolution: "universal-test-renderer@npm:0.10.1" - dependencies: - "@types/react-reconciler": "npm:~0.31.0" - react-reconciler: "npm:~0.31.0" - peerDependencies: - react: ^19.0.0 - checksum: 10c0/b25d3c29bc316bb0adefa3746fd64d898bd02962ddafc02fe87e2d798bb0573c527f9b99e8b35706f73dec2f16189b6d52795d6ac5086c31906d78cf66e2515f - languageName: node - linkType: hard - "universal-user-agent@npm:^7.0.0, universal-user-agent@npm:^7.0.2": version: 7.0.3 resolution: "universal-user-agent@npm:7.0.3"