Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
export const captureConsole =
( testFn ) =>
( callback = () => {} ) => {
const original = globalThis.console;
const replacement = {
log: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
};
globalThis.console = replacement;
let val;
try {
val = testFn();
} finally {
globalThis.console = original;
}
callback( replacement );
return val;
};