Migrate core render util to use xterm.js as part of the rendering loop. (#19044)

This commit is contained in:
Jacob Richman
2026-02-18 16:46:50 -08:00
committed by GitHub
parent 04c52513e7
commit 04f65f3d55
213 changed files with 7065 additions and 3852 deletions

View File

@@ -231,28 +231,24 @@ describe('DebugProfiler Component', () => {
showDebugProfiler: false,
constrainHeight: false,
} as unknown as UIState);
// Mock process.stdin and stdout
// We need to be careful not to break the test runner's own output
// So we might want to skip mocking them if they are not strictly needed for the simple render test
// or mock them safely.
// For now, let's assume the component uses them in useEffect.
});
afterEach(() => {
vi.restoreAllMocks();
});
it('should return null when showDebugProfiler is false', () => {
it('should return null when showDebugProfiler is false', async () => {
vi.mocked(useUIState).mockReturnValue({
showDebugProfiler: false,
constrainHeight: false,
} as unknown as UIState);
const { lastFrame } = render(<DebugProfiler />);
expect(lastFrame()).toBe('');
const { lastFrame, waitUntilReady, unmount } = render(<DebugProfiler />);
await waitUntilReady();
expect(lastFrame({ allowEmpty: true })).toBe('');
unmount();
});
it('should render stats when showDebugProfiler is true', () => {
it('should render stats when showDebugProfiler is true', async () => {
vi.mocked(useUIState).mockReturnValue({
showDebugProfiler: true,
constrainHeight: false,
@@ -261,12 +257,14 @@ describe('DebugProfiler Component', () => {
profiler.totalIdleFrames = 5;
profiler.totalFlickerFrames = 2;
const { lastFrame } = render(<DebugProfiler />);
const { lastFrame, waitUntilReady, unmount } = render(<DebugProfiler />);
await waitUntilReady();
const output = lastFrame();
expect(output).toContain('Renders: 10 (total)');
expect(output).toContain('5 (idle)');
expect(output).toContain('2 (flicker)');
unmount();
});
it('should report an action when a CoreEvent is emitted', async () => {
@@ -277,11 +275,13 @@ describe('DebugProfiler Component', () => {
const reportActionSpy = vi.spyOn(profiler, 'reportAction');
const { unmount } = render(<DebugProfiler />);
const { waitUntilReady, unmount } = render(<DebugProfiler />);
await waitUntilReady();
act(() => {
await act(async () => {
coreEvents.emitModelChanged('new-model');
});
await waitUntilReady();
expect(reportActionSpy).toHaveBeenCalled();
unmount();
@@ -295,11 +295,13 @@ describe('DebugProfiler Component', () => {
const reportActionSpy = vi.spyOn(profiler, 'reportAction');
const { unmount } = render(<DebugProfiler />);
const { waitUntilReady, unmount } = render(<DebugProfiler />);
await waitUntilReady();
act(() => {
await act(async () => {
appEvents.emit(AppEvent.SelectionWarning);
});
await waitUntilReady();
expect(reportActionSpy).toHaveBeenCalled();
unmount();