expo-updates
Version:
Fetches and manages remotely-hosted assets and updates to your app's JS bundle.
21 lines (19 loc) • 627 B
text/typescript
export async function withConsoleDisabledAsync<T>(block: () => Promise<T>): Promise<T> {
const loggingFunctions = {
log: console.log,
warn: console.warn,
error: console.error,
};
// Disable logging for this command since the only thing printed to stdout should be the JSON output.
console.log = function () {};
console.warn = function () {};
console.error = function () {};
try {
return await block();
} finally {
// Re-enable logging functions for testing.
console.log = loggingFunctions.log;
console.warn = loggingFunctions.warn;
console.error = loggingFunctions.error;
}
}