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

Commitcfa316b

Browse files
authored
fix: incomplete message when intercepting console logger (#1875)
I was getting a message like "Warning: Failed type %s: %s%s".
1 parentdd1484e commitcfa316b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎site/jest.setup.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import"@testing-library/jest-dom"
22
importcryptofrom"crypto"
3+
import*asutilfrom"util"
34
import{server}from"./src/testHelpers/server"
45

56
// Polyfill the getRandomValues that is used on utils/random.ts
@@ -43,8 +44,9 @@ CONSOLE_FAIL_TYPES.forEach((logType: string) => {
4344
// Suppressing the no-explicit-any to override certain console functions for testing
4445
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4546
constconsoleAsAny=global.consoleasany
46-
consoleAsAny[logType]=(message:string):void=>{
47-
thrownewError(`Failing due to console.${logType} while running test!\n\n${message}`)
47+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
48+
consoleAsAny[logType]=(format:string, ...args:any[]):void=>{
49+
thrownewError(`Failing due to console.${logType} while running test!\n\n${util.format(format, ...args)}`)
4850
}
4951
})
5052

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp