Download wp-calypso/client/test-helpers/console/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 374 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/test-helpers/console/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/test-helpers/console/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/test-helpers/console/index.js
374 Bytes
| 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; | |
| }; | |