a280b4f684
- Auto-detect interactive mode via is-in-ci + stdout.isTTY - writeToStdout/writeToStderr with frame clear/restore coordination - Non-interactive mode: static immediate, dynamic at unmount - Cursor position tracking for Phase 5 useCursor integration - useStdout/useStderr route through coordinated context methods Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26 lines
834 B
TypeScript
26 lines
834 B
TypeScript
import { defineComponent, onMounted } from "vue";
|
|
import { expect, test } from "vite-plus/test";
|
|
import { render } from "@vue-tui/testing";
|
|
import { Text, useStderr } from "@vue-tui/runtime";
|
|
|
|
test("useStderr.write does not corrupt active frame in debug mode", async () => {
|
|
const App = defineComponent(() => {
|
|
const { write } = useStderr();
|
|
onMounted(() => write("err line\n"));
|
|
return () => <Text>UI</Text>;
|
|
});
|
|
const { lastFrame } = await render(App);
|
|
expect(lastFrame()).toContain("UI");
|
|
});
|
|
|
|
test("useStderr returns stderr stream from context", async () => {
|
|
let stderrRef: NodeJS.WriteStream | undefined;
|
|
const App = defineComponent(() => {
|
|
const { stderr } = useStderr();
|
|
stderrRef = stderr;
|
|
return () => <Text>hello</Text>;
|
|
});
|
|
await render(App);
|
|
expect(stderrRef).toBeDefined();
|
|
});
|