Skip to content

Commit cb85eb2

Browse files
author
weiesky.wangc
committed
fix: await server shutdown in test to prevent EPIPE on CI Linux
1 parent 6be2427 commit cb85eb2

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

test/server.test.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,16 @@ describe('server API endpoints', () => {
6767
assert.ok(port > 0, 'port should be assigned');
6868
});
6969

70-
after(() => {
71-
stopViewer();
72-
rmSync(tmpDir, { recursive: true, force: true });
70+
after(async () => {
71+
// Wait for server to fully close to avoid EPIPE from lingering async activity
72+
await new Promise((resolve) => {
73+
stopViewer();
74+
// Give server.close() time to finish pending connections
75+
setTimeout(() => {
76+
rmSync(tmpDir, { recursive: true, force: true });
77+
resolve();
78+
}, 200);
79+
});
7380
});
7481

7582
// --- CORS ---

0 commit comments

Comments
 (0)