错误:
这个错误只在我运行jest的CI时弹出。我无法以任何方式在本地捕获它。错误文本:
FAIL src/utils/message.test.ts
● Test suite failed to run
TypeError: Cannot assign to read only property 'performance' of object '[object global]'
5 |
6 | jest
> 7 | .useFakeTimers({ legacyFakeTimers: false })
| ^
8 | .setSystemTime(new Date(fakeTime));
9 |
10 | jest.mock('src/constants/env', () => {
at hijackMethod (../node_modules/@sinonjs/fake-timers/src/fake-timers-src.js:946:32)
at Object.install (../node_modules/@sinonjs/fake-timers/src/fake-timers-src.js:1733:17)
at Object.<anonymous> (src/utils/message.test.ts:7:4)
字符串
1条答案
按热度按时间w80xi6nr1#
解决方案
在
src/utils/message.test.ts
(您的测试文件)中,在useFakeTimers
之前使用它字符串
结果代码
型
谢谢
https://github.com/facebook/react-native/issues/35701#issuecomment-1847579429