Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest tests ? #3

Open
note89 opened this issue Mar 23, 2016 · 4 comments
Open

Jest tests ? #3

note89 opened this issue Mar 23, 2016 · 4 comments

Comments

@note89
Copy link

note89 commented Mar 23, 2016

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

@zuhair-naqvi
Copy link

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

  • TypeError: Component is not a function
    at StatelessComponent.render (node_modules/react/lib/ReactCompositeComponent.js:44:10)
    1 test failed, 2 tests passed (3 total in 1 test suite, run time 1.269s)
    npm ERR! Test failed. See above for more details.

@calclavia
Copy link

Seems like there are problems with Jest and Enzyme :( jestjs/jest#1175

@Madalosso
Copy link

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

@yanivefraim
Copy link

yanivefraim commented Nov 10, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants