Skip to content

Commit cbac17c

Browse files
authored
test: assert new minified error message on react canary (#1199)
1 parent ebd9b09 commit cbac17c

4 files changed

Lines changed: 30 additions & 8 deletions

File tree

.github/workflows/ci-rsc.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ jobs:
6868
- name: install react
6969
if: ${{ matrix.react_version }}
7070
run: |
71-
sed -i "/^overrides:/a\ react: \"$REACT_VERSION\"" pnpm-workspace.yaml
72-
sed -i "/^overrides:/a\ react-dom: \"$REACT_VERSION\"" pnpm-workspace.yaml
73-
sed -i "/^overrides:/a\ react-server-dom-webpack: \"$REACT_VERSION\"" pnpm-workspace.yaml
71+
./scripts/override-react.sh "$REACT_VERSION"
7472
pnpm i --no-frozen-lockfile
7573
env:
7674
REACT_VERSION: ${{ matrix.react_version }}

packages/plugin-rsc/e2e/basic.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
expect,
88
test,
99
} from '@playwright/test'
10+
import React from 'react'
1011
import { x } from 'tinyexec'
1112
import { normalizePath, type Rollup } from 'vite'
1213
import { type Fixture, useCreateEditor, useFixture } from './fixture'
@@ -1277,6 +1278,12 @@ function defineTest(f: Fixture) {
12771278
await expect(page.getByTestId('action-error-boundary')).toContainText(
12781279
'(Error: boom!)',
12791280
)
1281+
} else if (/canary|experimental/.test(React.version)) {
1282+
// this is now minified on main
1283+
// https://github.com/facebook/react/pull/36277
1284+
await expect(page.getByTestId('action-error-boundary')).toContainText(
1285+
'(Error: Minified React error #441',
1286+
)
12801287
} else {
12811288
await expect(page.getByTestId('action-error-boundary')).toContainText(
12821289
'(Error: An error occurred in the Server Components render.',

packages/plugin-rsc/e2e/react-router.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { createHash } from 'node:crypto'
22
import { readFileSync } from 'node:fs'
33
import { expect, test } from '@playwright/test'
4-
import React from 'react'
54
import { type Fixture, useFixture } from './fixture'
65
import { expectNoReload, testNoJs, waitForHydration } from './helper'
76

87
test.describe('dev-default', () => {
9-
test.skip(/canary|experimental/.test(React.version))
10-
118
const f = useFixture({ root: 'examples/react-router', mode: 'dev' })
129
defineTest(f)
1310
})
@@ -18,8 +15,6 @@ test.describe('build-default', () => {
1815
})
1916

2017
test.describe('dev-cloudflare', () => {
21-
test.skip(/canary|experimental/.test(React.version))
22-
2318
const f = useFixture({
2419
root: 'examples/react-router',
2520
mode: 'dev',

scripts/override-react.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [[ $# -ne 1 ]]; then
5+
echo "Usage: $0 <react-version>" >&2
6+
exit 1
7+
fi
8+
9+
if ! command -v yq >/dev/null 2>&1; then
10+
echo "yq is required to update pnpm-workspace.yaml" >&2
11+
exit 1
12+
fi
13+
14+
react_version=$1
15+
script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
16+
repo_root=$(cd -- "$script_dir/.." && pwd)
17+
18+
yq -i "
19+
.overrides.react = \"$react_version\" |
20+
.overrides[\"react-dom\"] = \"$react_version\" |
21+
.overrides[\"react-server-dom-webpack\"] = \"$react_version\"
22+
" "$repo_root/pnpm-workspace.yaml"

0 commit comments

Comments
 (0)