Skip to content

Commit c3dbe49

Browse files
saphidclaude
andcommitted
test(cli): pending-restart update test runs without terminals
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 22eb7fa commit c3dbe49

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎apps/server/src/cli/update.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,28 @@ it.layer(NodeServices.layer)("t3 update launcher", (it) => {
367367
);
368368
});
369369

370+
// Without terminals, update skips its restart prompt whatever runs the test.
371+
const withoutTerminals = Effect.acquireRelease(
372+
Effect.sync(() =>
373+
[process.stdin, process.stdout].map((stream) => {
374+
const descriptor = Object.getOwnPropertyDescriptor(stream, "isTTY");
375+
Object.defineProperty(stream, "isTTY", { configurable: true, value: false });
376+
return { stream, descriptor };
377+
}),
378+
),
379+
(saved) =>
380+
Effect.sync(() => {
381+
for (const { stream, descriptor } of saved) {
382+
if (descriptor === undefined) Reflect.deleteProperty(stream, "isTTY");
383+
else Object.defineProperty(stream, "isTTY", descriptor);
384+
}
385+
}),
386+
);
387+
370388
it.layer(NodeServices.layer)("t3 update with a background service", (it) => {
371389
it.effect("names the version a service with a pending restart still runs", () =>
372390
Effect.gen(function* () {
391+
yield* withoutTerminals;
373392
const fs = yield* FileSystem.FileSystem;
374393
const path = yield* Path.Path;
375394
const baseDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-update-" });

0 commit comments

Comments
 (0)