mirror of https://github.com/facebook/jest.git
fix: `bigint` cause error (#15702)
This commit is contained in:
parent
f4296d2bc8
commit
a3d1e2eb4b
|
@ -1,5 +1,9 @@
|
|||
## main
|
||||
|
||||
### Fixes
|
||||
|
||||
- `[expect]` Fix `bigint` error ([#15702](https://github.com/jestjs/jest/pull/15702))
|
||||
|
||||
## 30.0.4
|
||||
|
||||
### Features
|
||||
|
|
|
@ -328,6 +328,15 @@ describe('toThrow', () => {
|
|||
});
|
||||
});
|
||||
|
||||
test('isNot false, cause is bigint', () => {
|
||||
jestExpect(() => {
|
||||
throw new Error('Message', {cause: 0n});
|
||||
}).toThrow({
|
||||
cause: 0n,
|
||||
message: 'Message',
|
||||
});
|
||||
});
|
||||
|
||||
test('isNot false, cause is object', () => {
|
||||
jestExpect(() => {
|
||||
throw new Error('Message', {
|
||||
|
|
|
@ -486,7 +486,10 @@ function createMessageAndCause(error: Error) {
|
|||
if (seen.has(value)) return;
|
||||
seen.add(value); // stop circular references
|
||||
}
|
||||
return value === undefined ? String(undefined) : value;
|
||||
if (typeof value === 'bigint' || value === undefined) {
|
||||
return String(value);
|
||||
}
|
||||
return value;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue