Skip to content

test(tanstack-start): Add e2e test application#1223

Open
nicohrubec wants to merge 5 commits intomasterfrom
nh/tss-e2e
Open

test(tanstack-start): Add e2e test application#1223
nicohrubec wants to merge 5 commits intomasterfrom
nh/tss-e2e

Conversation

@nicohrubec
Copy link
Member

@nicohrubec nicohrubec commented Feb 12, 2026

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

Closes #1214

@nicohrubec nicohrubec marked this pull request as ready for review February 12, 2026 14:23

test('runs on prod mode correctly', async () => {
await checkIfRunsOnProdMode(projectDir, 'Listening on');
});
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

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

this is true for angular but not for other tests

Copy link
Member

Choose a reason for hiding this comment

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

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:

Screenshot 2026-02-20 at 16 40 35

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice thank you!

Copy link
Member Author

Choose a reason for hiding this comment

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

Now it works on macOS but still fails on linux lol

Copy link
Member

Choose a reason for hiding this comment

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

I see a good step forward. I'll check out what is happening on linux as well

tanstackStart({ srcDirectory: 'src' }),
viteReact(),
nitro(),
],
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

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,
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Tanstack Start React E2E test application

2 participants