test(tanstack-start): Add e2e test application#1223
test(tanstack-start): Add e2e test application#1223nicohrubec wants to merge 5 commits intomasterfrom
Conversation
|
|
||
| test('runs on prod mode correctly', async () => { | ||
| await checkIfRunsOnProdMode(projectDir, 'Listening on'); | ||
| }); |
There was a problem hiding this comment.
Dev test before prod test corrupts build output
High Severity
The runs on dev mode correctly test is ordered before runs on prod mode correctly, unlike all other e2e tests in this repo (e.g. angular-17, angular-19) which consistently run prod before dev. The prod test depends on the .output/server/index.mjs file created by the build step, but running vite dev (TanStack Start / Nitro dev server) in between likely cleans or overwrites the .output directory, causing the subsequent npm run start to fail. Swapping the order of the dev and prod tests to match the existing pattern would fix this.
There was a problem hiding this comment.
this is true for angular but not for other tests
There was a problem hiding this comment.
For me it was reproducible locally with yarn test:e2e:bin "tanstack-start"
It seems that tanstack doesn't like the TEST env variable. When this is added then it doesn't add the Listening on output as shown in the following image:
Locally I fixed it by changing the following in the ProcessRunner (not sure though if this is a valid fix):
- this.taskHandle = spawn(cmd, args, { cwd: opts?.cwd, stdio: 'pipe' });
+ const { TEST: _test, ...envWithoutTest } = process.env;
+ this.taskHandle = spawn(cmd, args, {
+ cwd: opts?.cwd,
+ stdio: 'pipe',
+ env: envWithoutTest,
+ });Most possible culprit are these lines: https://github.com/h3js/srvx/blob/6ca26768ef4214513d34997f3346e6fcd57358b5/src/_utils.ts#L34-L36
There was a problem hiding this comment.
Now it works on macOS but still fails on linux lol
There was a problem hiding this comment.
I see a good step forward. I'll check out what is happening on linux as well
| tanstackStart({ srcDirectory: 'src' }), | ||
| viteReact(), | ||
| nitro(), | ||
| ], |
There was a problem hiding this comment.
Vite plugin order differs from documented recommendation
Medium Severity
The TanStack Start documentation specifies the Vite plugin order as tanstackStart(), nitro(), viteReact(), but here nitro() is placed after viteReact(). Vite plugin hook execution follows array order, so this incorrect ordering could cause build or runtime failures — potentially explaining the Linux CI failures mentioned in the PR discussion.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| ) { | ||
| const npmRunner = new ProcessRunner('npm', ['run', startCommand], { | ||
| cwd: projectDir, | ||
| stripTestEnvVars: true, |
There was a problem hiding this comment.
Dev mode missing stripTestEnvVars for TanStack Start
Medium Severity
The PR discussion identifies that TanStack Start doesn't like the TEST env variable. stripTestEnvVars: true was added to checkIfBuilds and checkIfRunsOnProdMode, but checkIfRunsOnDevMode was not updated — it still passes the TEST env var through to the spawned process. Since the TanStack Start dev server also uses the nitro() Vite plugin (see vite.config.ts), the dev mode test is likely affected by the same TEST env var issue.


Adding a basic e2e test setup for Tanstack Start as a first step.
Closes #1214