According to the docs, jest can only be used to test js files. Can we use it to test the jsx? Jsx files? Can we use it to test jsx files? If so, how?
You can use babel-jest for testing jsx file. Read more at here
To run test for jsx file you need to add more .jsx when unmock or import implement code.
Example:
For Js file: jest.unmock('../jsx/CheckboxWithLabel')
For JSX file: jest.unmock('../jsx/CheckboxWithLabel.jsx')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With