test: move #2084 exitCode-containment lifecycle tests to the serial quarantine (R3)

This commit is contained in:
Garry Tan
2026-06-12 00:05:26 -07:00
parent 542092c9c4
commit 9609a8d252
2 changed files with 35 additions and 35 deletions
@@ -219,3 +219,38 @@ describe('PGLiteEngine.disconnect() — v0.41.8.0 lifecycle invariants', () => {
}
});
});
// ─────────────────────────────────────────────────────────────────
// #2084 — preservingProcessExitCode behavioral containment
// ─────────────────────────────────────────────────────────────────
describe('PGLiteEngine: Emscripten process.exitCode containment (#2084)', () => {
test('connect() leaves process.exitCode pinned at 0, not the Emscripten 99', async () => {
const prev = process.exitCode;
const eng = new PGLiteEngine();
try {
await eng.connect({ engine: 'pglite' });
// Emscripten writes 99 during create; the wrapper pins explicit 0 when
// nothing was set before (undefined cannot be restored — the accessor
// falls back to the WASM status).
expect(Number(process.exitCode)).toBe(0);
} finally {
await eng.disconnect();
process.exitCode = prev;
}
}, 60_000);
test('a pre-call verdict survives the create-throw path (finally restores)', async () => {
const prev = process.exitCode;
const eng = new PGLiteEngine();
try {
process.exitCode = 3;
// A dataDir under a regular FILE cannot be created — PGlite.create rejects.
await expect(
eng.connect({ engine: 'pglite', database_path: '/dev/null/nope/brain' }),
).rejects.toThrow();
expect(Number(process.exitCode)).toBe(3);
} finally {
process.exitCode = prev;
}
}, 60_000);
});
-35
View File
@@ -1299,41 +1299,6 @@ describe('PGLiteEngine: getHealth graph metrics', () => {
});
});
// ─────────────────────────────────────────────────────────────────
// #2084 — preservingProcessExitCode behavioral containment
// ─────────────────────────────────────────────────────────────────
describe('PGLiteEngine: Emscripten process.exitCode containment (#2084)', () => {
test('connect() leaves process.exitCode pinned at 0, not the Emscripten 99', async () => {
const prev = process.exitCode;
const eng = new PGLiteEngine();
try {
await eng.connect({ engine: 'pglite' });
// Emscripten writes 99 during create; the wrapper pins explicit 0 when
// nothing was set before (undefined cannot be restored — the accessor
// falls back to the WASM status).
expect(Number(process.exitCode)).toBe(0);
} finally {
await eng.disconnect();
process.exitCode = prev;
}
}, 60_000);
test('a pre-call verdict survives the create-throw path (finally restores)', async () => {
const prev = process.exitCode;
const eng = new PGLiteEngine();
try {
process.exitCode = 3;
// A dataDir under a regular FILE cannot be created — PGlite.create rejects.
await expect(
eng.connect({ engine: 'pglite', database_path: '/dev/null/nope/brain' }),
).rejects.toThrow();
expect(Number(process.exitCode)).toBe(3);
} finally {
process.exitCode = prev;
}
}, 60_000);
});
// ─────────────────────────────────────────────────────────────────
// v0.13.1 — PGLite.create() error-wrap (structural guard for #223)
// ─────────────────────────────────────────────────────────────────