Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cfe5ab5
consider root route when checking non nested paths
nlynzaad Sep 26, 2025
6042874
add e2e test for spa mode
nlynzaad Sep 26, 2025
b530675
minor cleanup
nlynzaad Sep 26, 2025
92280f4
Merge branch 'main' into #5171-consider-root-route
nlynzaad Sep 26, 2025
a4bb5d7
update lock file
nlynzaad Sep 26, 2025
ed0ec24
ci: apply automated fixes
autofix-ci[bot] Sep 26, 2025
d4af3a3
few code rabbit suggestions
nlynzaad Sep 27, 2025
0c5630c
update lock file
nlynzaad Sep 27, 2025
b391c50
ci: apply automated fixes
autofix-ci[bot] Sep 27, 2025
7d08281
revert stream suggestion
nlynzaad Sep 27, 2025
e98d653
Merge remote-tracking branch 'origin/#5171-consider-root-route' into …
nlynzaad Sep 27, 2025
2f55a9f
resolve test issues
nlynzaad Sep 27, 2025
83404a4
resolve test issues
nlynzaad Sep 27, 2025
4a6f1c1
Merge branch 'main' into #5171-consider-root-route
nlynzaad Sep 27, 2025
23c053c
nitpick
nlynzaad Sep 27, 2025
4c31a87
try and fix flaky test again
nlynzaad Sep 27, 2025
e327916
try again
nlynzaad Sep 27, 2025
e2cfa74
try again
nlynzaad Sep 27, 2025
56aad43
use playwright env option
nlynzaad Sep 27, 2025
bb06ce9
use constant
nlynzaad Sep 27, 2025
f888251
combine basic and basic-spa
nlynzaad Sep 27, 2025
9ea02f0
ci: apply automated fixes
autofix-ci[bot] Sep 27, 2025
8079976
update playwright env
nlynzaad Sep 27, 2025
373681f
Merge remote-tracking branch 'origin/#5171-consider-root-route' into …
nlynzaad Sep 27, 2025
12c23a5
replicate e2e for solidjs
nlynzaad Sep 27, 2025
ebb9887
ci: apply automated fixes
autofix-ci[bot] Sep 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion e2e/react-start/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"dev:e2e": "vite dev",
"build": "vite build && tsc --noEmit",
"start": "pnpx srvx --prod -s ../client dist/server/server.js",
"test:e2e": "rm -rf port*.txt; playwright test --project=chromium"
"test:e2e:spaMode": "rm -rf port*.txt; MODE=spa playwright test --project=chromium",
"test:e2e:ssrMode": "rm -rf port*.txt; playwright test --project=chromium",
"test:e2e": "pnpm run test:e2e:spaMode && pnpm run test:e2e:ssrMode"
},
"dependencies": {
"@tanstack/react-router": "workspace:^",
Expand Down
18 changes: 15 additions & 3 deletions e2e/react-start/basic/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ import {
getDummyServerPort,
getTestServerPort,
} from '@tanstack/router-e2e-utils'
import { isSpaMode } from 'tests/utils/isSpaMode'
import packageJson from './package.json' with { type: 'json' }

const PORT = await getTestServerPort(packageJson.name)
const EXTERNAL_PORT = await getDummyServerPort(packageJson.name)
const baseURL = `http://localhost:${PORT}`
const spaModeCommand = `pnpm build && pnpm dev:e2e --port=${PORT}`
Copy link
Member

Choose a reason for hiding this comment

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

Testing using dev for spa mode?

Copy link
Member

Choose a reason for hiding this comment

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

If this is a limitation of the single playwright entry, then maybe we can just have a spa mode specific entry like we have in the scroll restoration sandbox.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

using dev for spa only to ensure we are mounting in the shell and running the server. not entirely sure yet how to mount the shell and server.ts correctly for production in the test.

Copy link
Contributor

Choose a reason for hiding this comment

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

you would need to serve the shell (and the other static files) via a custom http server and proxy through the requests for server functions etc to the actual start backend.

const ssrModeCommand = `pnpm build && pnpm start`

console.log('running in spa mode: ', isSpaMode.toString())
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
workers: 1,

reporter: [['line']],

globalSetup: './tests/setup/global.setup.ts',
Expand All @@ -27,16 +30,25 @@ export default defineConfig({
},

webServer: {
command: `VITE_NODE_ENV="test" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && VITE_NODE_ENV="test" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,
command: isSpaMode ? spaModeCommand : ssrModeCommand,
url: baseURL,
reuseExistingServer: !process.env.CI,
stdout: 'pipe',
env: {
MODE: process.env.MODE || '',
VITE_NODE_ENV: 'test',
VITE_EXTERNAL_PORT: String(EXTERNAL_PORT),
VITE_SERVER_PORT: String(PORT),
PORT: String(PORT),
},
},

projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
use: {
...devices['Desktop Chrome'],
},
},
],
})
Loading
Loading