- Notifications
You must be signed in to change notification settings - Fork928
refactor: clean up types in jest.setup.ts#4285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -38,16 +38,12 @@ afterAll(() => server.close()) | ||
// For now, I limited this to just 'error' - but failing on warnings | ||
// would be a nice next step! We may need to filter out some noise | ||
// from material-ui though. | ||
const CONSOLE_FAIL_TYPES = ["error" /* 'warn' */] as const | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Using | ||
// Throw errors when a `console.error` or `console.warn` happens | ||
// by overriding the functions | ||
CONSOLE_FAIL_TYPES.forEach((logType: typeof CONSOLE_FAIL_TYPES[number]) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. here | ||
global.console[logType] = <Type>(format: string, ...args: Type[]): void => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Using the generic, we no longer need to use | ||
throw new Error( | ||
`Failing due to console.${logType} while running test!\n\n${util.format(format, ...args)}`, | ||
) | ||