Skip to content

Commit ba2ebe6

Browse files
committed
fix(e2e): add serve log file dump on polling failure for debugging
1 parent 0378aff commit ba2ebe6

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

integration/models/application.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,25 @@ export const application = (
176176
});
177177

178178
if (opts.detached) {
179+
proc.on('exit', (code, signal) => {
180+
log(`Serve process exited: code=${code}, signal=${signal}`);
181+
});
179182
const shouldExit = () => !!proc.exitCode && proc.exitCode !== 0;
180-
await waitForServer(runtimeServerUrl, { log, maxAttempts: 120, shouldExit });
183+
try {
184+
await waitForServer(runtimeServerUrl, { log, maxAttempts: 120, shouldExit });
185+
} catch (e) {
186+
// Dump log files for debugging
187+
try {
188+
const stdout = await fs.readFile(stdoutFilePath, 'utf-8');
189+
const stderr = await fs.readFile(stderrFilePath, 'utf-8');
190+
log(`Serve stdout log:\n${stdout}`);
191+
log(`Serve stderr log:\n${stderr}`);
192+
} catch {
193+
log('Could not read serve log files');
194+
}
195+
log(`Serve process exitCode=${proc.exitCode}, killed=${proc.killed}, pid=${proc.pid}`);
196+
throw e;
197+
}
181198
} else {
182199
await waitForIdleProcess(proc);
183200
}

0 commit comments

Comments
 (0)