Skip to content
Source
Sign inSign up
TanStack/router

fix(start-plugin-core): serve the dev server in test mode #8654

Openanzal1(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/8654/headopened

Showing 3 changed files with 70 additions and 8 deletions.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/quiet-test-mode-dev.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/start-plugin-core': patch
+---
+​
+Serve the app from the Start dev server when Vite runs with `--mode test`. The dev server middleware was skipped in test mode, so `vite dev --mode test` returned `404 Cannot GET /`.
65 additions and 0 deletionse2e/react-start/basic/tests/dev-test-mode.spec.tsAdded
View file
@@ -0,0 +1,65 @@
+import { spawn } from 'node:child_process'
+import net from 'node:net'
+import { expect, test } from '@playwright/test'
+​
+// https://github.com/TanStack/router/issues/4620
+// `vite dev --mode test` must serve the app through the Start dev server.
+// The server is started here because the Nx modes only start built output.
+test.skip(
+ process.env.E2E_TOOLCHAIN !== 'vite' || process.env.MODE !== 'ssr',
+ 'runs once, in the vite ssr mode',
+)
+​
+function getFreePort() {
+ return new Promise<number>((resolve, reject) => {
+ const server = net.createServer()
+ server.once('error', reject)
+ server.listen(0, () => {