Я пытаюсь запустить тесты jests для моего проекта React, но я продолжаю получать эту ошибку на некоторых из моих компонентов. Вот как выглядит полная ошибка.
Ошибка:
● testing CreateView component › testing CreateView component when calling onChange › calling onChange
TypeError: Cannot set property 'font' of null
92 | test('calling onChange', () => {
93 |
> 94 | const wrapper = Enzyme.mount(
| ^
95 | <Provider store={store}>
96 | <Router>
97 | <CreateView />
at measureText (node_modules/update-input-width/dist/umd/index.js:44:16)
at updateInputWidth (node_modules/update-input-width/dist/umd/index.js:64:15)
at ref (node_modules/react-date-picker/dist/DateInput/Input.js:121:42)
at commitAttachRef (node_modules/react-dom/cjs/react-dom.development.js:22310:7)
at commitLayoutEffects (node_modules/react-dom/cjs/react-dom.development.js:25349:7)
at HTMLUnknownElement.callCallback (node_modules/react-dom/cjs/react-dom.development.js:336:14)
at invokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
at HTMLUnknownElementImpl._dispatch (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
at HTMLUnknownElementImpl.dispatchEvent (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
at HTMLUnknownElementImpl.dispatchEvent (node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
at HTMLUnknownElement.dispatchEvent (node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
at Object.invokeGuardedCallbackDev (node_modules/react-dom/cjs/react-dom.development.js:385:16)
at invokeGuardedCallback (node_modules/react-dom/cjs/react-dom.development.js:440:31)
at commitRootImpl (node_modules/react-dom/cjs/react-dom.development.js:25082:9)
at unstable_runWithPriority (node_modules/scheduler/cjs/scheduler.development.js:697:12)
at runWithPriority$2 (node_modules/react-dom/cjs/react-dom.development.js:12149:10)
at commitRoot (node_modules/react-dom/cjs/react-dom.development.js:24922:3)
at finishSyncRender (node_modules/react-dom/cjs/react-dom.development.js:24329:3)
at performSyncWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:24307:9)
at node_modules/react-dom/cjs/react-dom.development.js:12199:24
at unstable_runWithPriority (node_modules/scheduler/cjs/scheduler.development.js:697:12)
at runWithPriority$2 (node_modules/react-dom/cjs/react-dom.development.js:12149:10)
at flushSyncCallbackQueueImpl (node_modules/react-dom/cjs/react-dom.development.js:12194:7)
at flushSyncCallbackQueue (node_modules/react-dom/cjs/react-dom.development.js:12182:3)
at batchedUpdates$1 (node_modules/react-dom/cjs/react-dom.development.js:24392:7)
at Object.act (node_modules/react-dom/cjs/react-dom-test-utils.development.js:1092:14)
at wrapAct (node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:346:13)
at Object.render (node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:415:16)
at new ReactWrapper (node_modules/enzyme/src/ReactWrapper.js:115:16)
at Object.mount (node_modules/enzyme/src/mount.js:10:10)
at Object.test (src/tests/components/editor/CreateSOPDuplicateView.test.js:94:36)
Я не могу поделиться всем кодом, так как репозиторий закрыт, но любая помощь будет высоко ценится
РЕДАКТИРОВАТЬ:
Я думаю, что это как-то связано с модулем «реагировать на выбор даты», который я использую. Я получаю эту ошибку только при использовании этого модуля.