You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With @emotion/styled 11.11.5, when I test with this unit test:
import{mount}from'enzyme';importHome,{Button}from'./index';describe('button',()=>{it('should alert "Hello, Emotion!" when clicked',()=>{constbutton=mount(<Home/>);constalertSpy=jest.spyOn(window,'alert').mockImplementation();button.find(Button).simulate('click');expect(alertSpy).toHaveBeenCalledWith('Hello, Emotion!');});});
I get the following error:
TypeError: Cannotreadpropertiesofundefined(reading'__reactFiber$paxx60fbezr')atgetInstanceFromNode(C:\code\enzyme-adapter-react-emotion-issue\node_modules\react-dom\cjs\react-dom.development.js:11599:18)
at C:\code\enzyme-adapter-react-emotion-issue\node_modules\react-dom\cjs\react-dom-test-utils.development.js:1686:22
at C:\code\enzyme-adapter-react-emotion-issue\node_modules\@cfaester\enzyme-adapter-react-18\dist\ReactEighteenAdapter.js:425:21atact(C:\code\enzyme-adapter-react-emotion-issue\node_modules\react\cjs\react.development.js:2512:16)atObject.simulateEvent(C:\code\enzyme-adapter-react-emotion-issue\node_modules\@cfaester\enzyme-adapter-react-18\dist\ReactEighteenAdapter.js:424:23)atReactWrapper.call(C:\code\enzyme-adapter-react-emotion-issue\node_modules\enzyme\src\ReactWrapper.js:666:22)atReactWrapper.single(C:\code\enzyme-adapter-react-emotion-issue\node_modules\enzyme\src\ReactWrapper.js:1170:21)atReactWrapper.simulate(C:\code\enzyme-adapter-react-emotion-issue\node_modules\enzyme\src\ReactWrapper.js:665:17)atObject.<anonymous>(C:\code\enzyme-adapter-react-emotion-issue\src\pages\index.test.tsx:12:25)atPromise.then.completed(C:\code\enzyme-adapter-react-emotion-issue\node_modules\jest-circus\build\utils.js:298:28)atnewPromise(<anonymous>)atcallAsyncCircusFn(C:\code\enzyme-adapter-react-emotion-issue\node_modules\jest-circus\build\utils.js:231:10)at_callCircusTest(C:\code\enzyme-adapter-react-emotion-issue\node_modules\jest-circus\build\run.js:316:40)atprocessTicksAndRejections(node:internal/process/task_queues:95:5)atasync_runTest(C:\code\enzyme-adapter-react-emotion-issue\node_modules\jest-circus\build\run.js:252:3)atasync_runTestsForDescribeBlock(C:\code\enzyme-adapter-react-emotion-issue\node_modules\jest-circus\build\run.js:126:9)atasync_runTestsForDescribeBlock(C:\code\enzyme-adapter-react-emotion-issue\node_modules\jest-circus\build\run.js:121:9)atasyncrun(C:\code\enzyme-adapter-react-emotion-issue\node_modules\jest-circus\build\run.js:71:3)atasyncrunAndTransformResultsToJestFormat(C:\code\enzyme-adapter-react-emotion-issue\node_modules\jest-circus\build\legacy-code-todo-rewrite\jestAdapterInit.js:122:21)atasyncjestAdapter(C:\code\enzyme-adapter-react-emotion-issue\node_modules\jest-circus\build\legacy-code-todo-rewrite\jestAdapter.js:79:19)atasyncrunTestInternal(C:\code\enzyme-adapter-react-emotion-issue\node_modules\jest-runner\build\runTest.js:367:16)atasyncrunTest(C:\code\enzyme-adapter-react-emotion-issue\node_modules\jest-runner\build\runTest.js:444:34)
This seems like the same problem as was in the react-17 adapter: wojtekmaj/enzyme-adapter-react-17#45
I think I have a fix for this though, I'll create a PR
The text was updated successfully, but these errors were encountered:
When I have the following example component:
With @emotion/styled 11.11.5, when I test with this unit test:
I get the following error:
This seems like the same problem as was in the react-17 adapter: wojtekmaj/enzyme-adapter-react-17#45
I think I have a fix for this though, I'll create a PR
The text was updated successfully, but these errors were encountered: