Jest currently supports two environments out of the box: node and jsdom (cf http://facebook.github.io/jest/docs/configuration.html#testenvironment-string)
However jsdom lack the support of many browser features. You can take a quick look at all open requests: https://github.com/tmpvar/jsdom/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20label%3Afeature%20
And for sure, jsdom will always be behind Chrome in terms of feature support.
When testing a UI application, you end up adding a bunch of mocks or polyfills to complete jsdom.
Would you then consider adding support for headless chrome environment (on top of or as a replacement of jsdom)?
+1
+1
You may want to look into cypress.io
See #848. This is going to be a ton of work, it's not impossible, but currently nobody is working on it and it's not on our roadmap in the mid-term.
@cpojer Would you say making headless chrome work with Jest is less work that making Web Components work in JSDOM? I have a strong need for a solution, so I don't mind working on this. That being said I will need some guidance in order to get started. Thanks.
JSDOM won't support web components anytime soon, Headless Chrome / Puppeteer should replace it in Jest as the defacto
The problem with just doing a replacement is that puppeteer is async, so we need to bundle since require and import are synchronous. Bundling is out of scope.
You should follow #848 as linked earlier, although it's still not a priority (happy to review PRs that moves us closer to it, though)
jest-puppeteer is good, but it's not friendly to test react components. So I switched to karma-chrome-launcher. https://github.com/Army-U/karma-react-component-headless-example
There is https://github.com/hustcc/jest-electron ?
Most helpful comment
@cpojer Would you say making headless chrome work with Jest is less work that making Web Components work in JSDOM? I have a strong need for a solution, so I don't mind working on this. That being said I will need some guidance in order to get started. Thanks.