({ cwd, env }: { cwd: string; env: NodeJS.ProcessEnv })
| 11 | import { handleQuestions } from './handle-questions.js' |
| 12 | |
| 13 | export const getExecaOptions = ({ cwd, env }: { cwd: string; env: NodeJS.ProcessEnv }) => { |
| 14 | // Unused vars here are in order to omit LANg and LC_ALL from envs |
| 15 | |
| 16 | const { LANG, LC_ALL, ...baseEnv } = process.env |
| 17 | |
| 18 | // Diagnostics for the Node 24 serve-mode hang. The trace flags surface any |
| 19 | // uncaught exception, deprecation warning, or process.exit. --report-on-signal |
| 20 | // makes Node emit a full diagnostic report (stacks + libuv handles) on SIGUSR2, |
| 21 | // written to a file in cwd. The test util sends SIGUSR2 just before the |
| 22 | // start-timeout fires so the report captures *what* the process is stuck on. |
| 23 | // Note: --report-on-fatalerror, --report-uncaught-exception, and |
| 24 | // --report-filename are NOT permitted in NODE_OPTIONS (Worker threads reject |
| 25 | // env vars containing them), so we keep this list to the allowed subset. |
| 26 | const traceFlags = '--trace-warnings --trace-uncaught --trace-exit --report-on-signal --report-signal=SIGUSR2' |
| 27 | const nodeOptions = baseEnv.NODE_OPTIONS ? `${baseEnv.NODE_OPTIONS} ${traceFlags}` : traceFlags |
| 28 | |
| 29 | return { |
| 30 | cwd, |
| 31 | extendEnv: false, |
| 32 | env: { ...baseEnv, BROWSER: 'none', NODE_OPTIONS: nodeOptions, ...env }, |
| 33 | encoding: 'utf8', |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | export interface DevServer { |
| 38 | url: string |
no outgoing calls