-
Notifications
You must be signed in to change notification settings - Fork 436
feat(e2e): switch long-running test apps from dev to build+serve #7795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
📝 WalkthroughWalkthroughAdded exported helper 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@integration/models/longRunningApplication.ts`:
- Around line 109-110: The serve result (port, serverUrl, pid) is being
destructured into new local consts and not assigned to the outer variables, so
dev() can still see undefined; change the destructuring so the returned values
are assigned to the outer-scoped variables (e.g., remove "const" or explicitly
set port = ..., serverUrl = ..., pid = ...) before calling
stateFile.addLongRunningApp({ port, serverUrl, pid, id, appDir: app.appDir, env:
params.env.toJson() }) so the in-memory state is updated immediately after
app.serve() and dev()/init() will read the correct runtime info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@integration/models/application.ts`:
- Line 1: Add unit/integration tests that exercise the build+serve detached
flow: create a new test that invokes the code path which performs buildAndServe
(or startDetachedServe) with detached logging enabled, stubbing/mocking execSync
and any process/spawn calls to simulate detached child processes, and assert
that readinessCheck (or the readiness polling function) is called and that
detached logging output is captured/forwarded as expected; ensure the test fails
on missing readiness and covers both successful and timeout/error cases so the
change is covered by CI.
- Around line 150-156: The getServerUrl helper mis-detects presence of a port by
using .includes(':'') (which sees the scheme) so a value like
opts.serverUrl="http://localhost" won’t get the runtime port appended and the
process PORT and runtime URL can become unsynchronized; update getServerUrl to
parse opts.serverUrl with the URL constructor (or equivalent) to check for an
explicit port and if none append `:${port}` to the host, and also ensure
process.env.PORT (or the runtime PORT variable) is set to String(port) so
serve()/waitForServer use the same port; additionally add unit/integration tests
exercising serve() with a custom opts.serverUrl without port and the detached
mode flow to verify the returned server URL and readiness checks are correct.
The getServerUrl helper used .includes(':') to detect an explicit port,
which false-positived on the scheme colon (e.g. http://localhost).
Extract resolveServerUrl using the URL constructor and apply to both
dev() and serve().
srvx resolves --static path relative to the entry file directory (dist/server/), not CWD. Use ../client to correctly resolve to dist/client/ where built assets live.
Production servers like react-router-serve don't auto-load .env files (unlike Vite dev or srvx CLI). Read the .env file and pass all vars as process env to the serve command so Clerk keys are available at runtime.
Summary
Switch all 27 long-running integration test apps from
app.dev()(JIT compilation) toapp.build()+app.serve()(pre-compiled, static serving) for faster and cacheable test runs.Changes
serve()in the Application model to support detached mode with file-based logging and HTTP polling, aligning it withdev()serve()return type (pid: proc→pid: proc.pid).envfile and pass vars as process env to serve commands, since production servers (e.g.react-router-serve) don't auto-load.envfiles like Vite dev doesbuild()error stub fromlongRunningApplicationproxy--static ../clientrelative to entry file dir)srvxdependency for tanstack-start production servingNODE_ENV=productionfor react-router-servetsc,vue-tsc,astro check) — not needed for integration testingPORTenv in Astro and React Router configs (PORT is only set at serve time, not build time)CI timing comparison (dev mode vs build+serve)
Baseline = average of two recent dev-mode CI runs on another branch.
Most suites are within noise. The build overhead is paid in
global.setup(before test timing), while test-time page loads benefit from pre-compiled assets. The biggest wins are in frameworks with slow dev-mode compilation (astro, nextjs). Future runs will benefit further from build caching.Test plan
pnpm buildpasses.envvars available to production servermiddleware-placement.test.tsstill works (non-detached serve path unchanged)