Running into a Jest/enzyme error "Popper: Invalid reference or popper argument provided."

4.3k views Asked by At

I wrote a tooltip using popperjs 2.2.1, and jest/enzyme tests. However, I get the following error:

Error: Cannot read property 'split' of undefined

console.error ../../node_modules/@popperjs/core/dist/cjs/popper.js:630

Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.

Tried all of the recommendations in (maybe did it wrong as I am just getting into jest): https://github.com/popperjs/popper-core/issues/478 and https://github.com/popperjs/react-popper/issues/263

I recreated it in the codesandbox: https://codesandbox.io/s/tooltip-test-r8nqt?file=/src/Tooltip.spec.tsx

Any advice? tnx

1

There are 1 answers

0
Fez Vrasta On BEST ANSWER

You are not providing a placement property in the defaultProps object of your tests.