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 support documentation #66

Closed
11 tasks
blainekasten opened this issue Dec 11, 2015 · 4 comments
Closed
11 tasks

Jest support documentation #66

blainekasten opened this issue Dec 11, 2015 · 4 comments

Comments

@blainekasten
Copy link
Contributor

In order for this to work with jest, jest needs to know about some libraries specifically not to be mocked. It'd be nice if you could document this somewhere. This is specifically what I had to do to get tests running:

/package.json

{
  "jest": {
    "unmockedModulePathPatterns": [
      "enzyme",
      "cheerio",
      "htmlparser2",
      "sinon",
      "..."
    ]
  }
}

This is an exhaustive list of needed items

  • enzyme
  • cheerio
  • htmlparser2
  • sinon
  • underscore
  • lodash dep of cheerio, needed for render method
  • domhandler dep of htmlparser2, from cheerio
  • object.assign
  • define-properties
  • function-bind
  • object-keys
@lelandrichardson
Copy link
Collaborator

@blainekasten this is great. I have a PR out that i'm going to be adding some documentation stuff to. There will end up being a "guides" section, where there is a guide for working with various different environments (of which, jest will be one). This will be very helpful to add to that!

@blainekasten
Copy link
Contributor Author

For reference: recently, I needed to add "underscore" to the unmocked paths also.

@lelandrichardson
Copy link
Collaborator

This is good. I'll get something like this added into a guide for using enzyme with jest

@blainekasten
Copy link
Contributor Author

Also for reference, this list is primarily for npm3 due to jestjs/jest#554.

When using with npm2 and when that is fixed, it should be fine to just use

{
  "jest": {
    "unmockedModulePathPatterns": [
      "enzyme"
    ]
  }
}

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

No branches or pull requests

2 participants