MCPcopy
hub / github.com/Doorman11991/smallcode / runWithMockStdout

Function runWithMockStdout

test/tui_layout.test.js:17–36  ·  view source on GitHub ↗
(columns, rows, fn)

Source from the content-addressed store, hash-verified

15
16// Helper to mock stdout dimensions cleanly without boilerplate
17function runWithMockStdout(columns, rows, fn) {
18 const origColumns = process.stdout.columns;
19 const origRows = process.stdout.rows;
20 try {
21 Object.defineProperty(process.stdout, 'columns', {
22 value: columns,
23 writable: true,
24 configurable: true
25 });
26 Object.defineProperty(process.stdout, 'rows', {
27 value: rows,
28 writable: true,
29 configurable: true
30 });
31 fn();
32 } finally {
33 Object.defineProperty(process.stdout, 'columns', { value: origColumns, configurable: true });
34 Object.defineProperty(process.stdout, 'rows', { value: origRows, configurable: true });
35 }
36}
37
38test('Fullscreen TUI welcome screen - responsive widths', () => {
39 const widths = [1, 8, 12, 19, 30, 40, 80, 120];

Callers 1

tui_layout.test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected