814c482d6d
A [Vue warn] emitted during the initial mount (e.g. the missing-render- function warn from a root setup() throw) escaped the stderr filter because mount() installed the console patch only after originalMount. Ink patches in its constructor before the first React render (ink.tsx:435-436); move the install before originalMount to match. The mount-throw catch already restores the console via teardown(). Verified red-first against real Ink v7.0.4 (audit e10): Ink's stderr stays empty for a render-throwing component; vue-tui's initial-mount warn reached a real PTY before this fix. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import { test as it, expect } from "vite-plus/test";
|
|
import stripAnsi from "strip-ansi";
|
|
import { run } from "./helpers/run.ts";
|
|
|
|
// The console patch must be installed BEFORE the first Vue mount (Ink patches
|
|
// in its constructor, ink.tsx:435-436, before the first React render). A root
|
|
// whose setup() throws makes Vue emit its dev-only "[Vue warn]: Component is
|
|
// missing template or render function." DURING the initial mount — with the
|
|
// patch installed only after mount, that warn escaped to the real terminal
|
|
// even with patchConsole on.
|
|
it("filters a [Vue warn] emitted during the initial mount (patchConsole default)", async () => {
|
|
const output = await run("patch-console-initial-mount");
|
|
|
|
// waitUntilExit() still rejects with the setup error.
|
|
expect(output).toContain("waitUntilExit:rejected:setup boom");
|
|
|
|
const plain = stripAnsi(output);
|
|
|
|
// The error overview still renders (" ERROR <message>" after ANSI strip).
|
|
expect(plain).toContain(" ERROR ");
|
|
expect(plain).toContain("setup boom");
|
|
|
|
// No [Vue warn] line reaches the terminal.
|
|
const vueWarnLines = plain.split(/\r?\n/).filter((line) => line.startsWith("[Vue warn]"));
|
|
expect(vueWarnLines).toEqual([]);
|
|
});
|