Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions jest.setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,24 @@ jest.mock('@patternfly/patternfly-component-schemas/json', () => ({
throw new Error(`Component "${componentName}" not found`);
})
}), { virtual: true });

/**
* Suppress raw terminal output writes (screen clears, ANSI sequences) during unit test runs.
*/
const originalStdoutWrite = process.stdout.write.bind(process.stdout);

beforeEach(() => {
process.stdout.write = jest.fn().mockImplementation((chunk: string | Uint8Array, encoding?: unknown, callback?: unknown) => {
if (typeof encoding === 'function') {
encoding();
} else if (typeof callback === 'function') {
callback();
}

return true;
}) as unknown as typeof process.stdout.write;
});

afterEach(() => {
process.stdout.write = originalStdoutWrite;
});
Loading