Open note89 opened 8 years ago
Uncommenting jest tests (shallow render) throws this error:
Using Jest CLI v0.8.2, jasmine1 Running 1 test suite...Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). FAIL src/tests/Foo-test.js (0.912s) ● A suite › it contains spec with an expectation
Seems like there are problems with Jest and Enzyme :( https://github.com/facebook/jest/issues/1175
This can be solved updating jest-cli and using "import Foo from "./Foo" and use "jest.unmock()" instead of jest.dontMock() https://facebook.github.io/jest/docs/api.html#jest-unmock-modulename
I still get errors when trying to add uncomment mount
test. I updated jest-cli to version 17.0.0 + I changed to
jest.unmock('../Foo');
I get the following error:
src/tests/Foo-test.js Console
console.error node_modules/fbjs/lib/warning.js:45 Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). console.error node_modules/fbjs/lib/warning.js:45 Warning: Failed propType: Invalid prop `Component` supplied to `<<anonymous>>`.
A suite › contains spec with an expectation
TypeError: ReactDOM.render is not a function at Object.ReactTestUtils.renderIntoDocument (node_modules/react/lib/ReactTestUtils.js:76:21) at Object.<anonymous> (src/__tests__/Foo-test.js:19:30)
cc @Madalosso
All your tests are commented out, is this the official example ? https://github.com/lelandrichardson/enzyme-example-jest/blob/master/src/__tests__/Foo-test.js