Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitce95344

Browse files
authored
refactor: clean up types in jest.setup.ts (#4285)
1 parentcd4ab97 commitce95344

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

‎site/jest.setup.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,12 @@ afterAll(() => server.close())
3838
// For now, I limited this to just 'error' - but failing on warnings
3939
// would be a nice next step! We may need to filter out some noise
4040
// from material-ui though.
41-
constCONSOLE_FAIL_TYPES=["error"/* 'warn' */]
41+
constCONSOLE_FAIL_TYPES=["error"/* 'warn' */]asconst
4242

4343
// Throw errors when a `console.error` or `console.warn` happens
4444
// by overriding the functions
45-
CONSOLE_FAIL_TYPES.forEach((logType:string)=>{
46-
// Suppressing the no-explicit-any to override certain console functions for testing
47-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
48-
constconsoleAsAny=global.consoleasany
49-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
50-
consoleAsAny[logType]=(format:string, ...args:any[]):void=>{
45+
CONSOLE_FAIL_TYPES.forEach((logType:typeofCONSOLE_FAIL_TYPES[number])=>{
46+
global.console[logType]=<Type>(format:string, ...args:Type[]):void=>{
5147
thrownewError(
5248
`Failing due to console.${logType} while running test!\n\n${util.format(format, ...args)}`,
5349
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp