|
1 | 1 | import { createHash } from 'node:crypto' |
2 | | -import { readFileSync } from 'node:fs' |
3 | 2 | import { type Page, expect, test } from '@playwright/test' |
4 | 3 | import { type Fixture, setupIsolatedFixture, useFixture } from './fixture' |
5 | | -import { expectNoReload, testNoJs, waitForHydration } from './helper' |
| 4 | +import { |
| 5 | + expectNoReload, |
| 6 | + loadRSCManifest, |
| 7 | + testNoJs, |
| 8 | + waitForHydration, |
| 9 | +} from './helper' |
6 | 10 | import path from 'node:path' |
7 | 11 | import os from 'node:os' |
8 | 12 |
|
@@ -72,6 +76,58 @@ test.describe('build-base', () => { |
72 | 76 | defineTest(f) |
73 | 77 | }) |
74 | 78 |
|
| 79 | +test.describe('dev-render-builtin-url-runtime', () => { |
| 80 | + const f = useFixture({ |
| 81 | + root: 'examples/basic', |
| 82 | + mode: 'dev', |
| 83 | + cliOptions: { |
| 84 | + env: { |
| 85 | + TEST_RENDER_BUILTIN_URL: 'runtime', |
| 86 | + }, |
| 87 | + }, |
| 88 | + }) |
| 89 | + defineTest(f) |
| 90 | +}) |
| 91 | + |
| 92 | +test.describe('build-render-builtin-url-runtime', () => { |
| 93 | + const f = useFixture({ |
| 94 | + root: 'examples/basic', |
| 95 | + mode: 'build', |
| 96 | + cliOptions: { |
| 97 | + env: { |
| 98 | + TEST_RENDER_BUILTIN_URL: 'runtime', |
| 99 | + }, |
| 100 | + }, |
| 101 | + }) |
| 102 | + defineTest(f) |
| 103 | +}) |
| 104 | + |
| 105 | +test.describe('dev-render-builtin-url-string', () => { |
| 106 | + const f = useFixture({ |
| 107 | + root: 'examples/basic', |
| 108 | + mode: 'dev', |
| 109 | + cliOptions: { |
| 110 | + env: { |
| 111 | + TEST_RENDER_BUILTIN_URL: 'string', |
| 112 | + }, |
| 113 | + }, |
| 114 | + }) |
| 115 | + defineTest(f) |
| 116 | +}) |
| 117 | + |
| 118 | +test.describe('build-render-builtin-url-string', () => { |
| 119 | + const f = useFixture({ |
| 120 | + root: 'examples/basic', |
| 121 | + mode: 'build', |
| 122 | + cliOptions: { |
| 123 | + env: { |
| 124 | + TEST_RENDER_BUILTIN_URL: 'string', |
| 125 | + }, |
| 126 | + }, |
| 127 | + }) |
| 128 | + defineTest(f) |
| 129 | +}) |
| 130 | + |
75 | 131 | test.describe('dev-react-compiler', () => { |
76 | 132 | const f = useFixture({ |
77 | 133 | root: 'examples/basic', |
@@ -233,12 +289,9 @@ function defineTest(f: Fixture) { |
233 | 289 | .evaluateAll((elements) => |
234 | 290 | elements.map((el) => el.getAttribute('href')), |
235 | 291 | ) |
236 | | - const manifest = JSON.parse( |
237 | | - readFileSync( |
238 | | - f.root + '/dist/ssr/__vite_rsc_assets_manifest.js', |
239 | | - 'utf-8', |
240 | | - ).slice('export default '.length), |
241 | | - ) |
| 292 | + |
| 293 | + const manifest = await loadRSCManifest(f.root) |
| 294 | + |
242 | 295 | const hashString = (v: string) => |
243 | 296 | createHash('sha256').update(v).digest().toString('hex').slice(0, 12) |
244 | 297 | const deps = |
|
0 commit comments