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

Commita3d1e2e

Browse files
fix:bigint cause error (#15702)
1 parentf4296d2 commita3d1e2e

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
##main
22

3+
###Fixes
4+
5+
-`[expect]` Fix`bigint` error ([#15702](https://github.com/jestjs/jest/pull/15702))
6+
37
##30.0.4
48

59
###Features

‎packages/expect/src/__tests__/toThrowMatchers.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,15 @@ describe('toThrow', () => {
328328
});
329329
});
330330

331+
test('isNot false, cause is bigint',()=>{
332+
jestExpect(()=>{
333+
thrownewError('Message',{cause:0n});
334+
}).toThrow({
335+
cause:0n,
336+
message:'Message',
337+
});
338+
});
339+
331340
test('isNot false, cause is object',()=>{
332341
jestExpect(()=>{
333342
thrownewError('Message',{

‎packages/expect/src/toThrowMatchers.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,10 @@ function createMessageAndCause(error: Error) {
486486
if(seen.has(value))return;
487487
seen.add(value);// stop circular references
488488
}
489-
returnvalue===undefined ?String(undefined) :value;
489+
if(typeofvalue==='bigint'||value===undefined){
490+
returnString(value);
491+
}
492+
returnvalue;
490493
});
491494
}
492495

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp