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

Support headless chrome as a test environment #3940

Closed
jbe456 opened this issue Jun 29, 2017 · 11 comments
Closed

Support headless chrome as a test environment #3940

jbe456 opened this issue Jun 29, 2017 · 11 comments

Comments

@jbe456
Copy link

jbe456 commented Jun 29, 2017

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)?

@wx-chevalier
Copy link

+1

1 similar comment
@Martodox
Copy link

Martodox commented Jul 6, 2017

+1

@johntran
Copy link

johntran commented Jul 6, 2017

You may want to look into cypress.io

@cpojer
Copy link
Member

cpojer commented Jul 6, 2017

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 cpojer closed this as completed Jul 6, 2017
@ryansobol
Copy link

See https://github.com/GoogleChrome/puppeteer

@jstrimpel
Copy link

@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.

@greg-benner-klick-sensei

JSDOM won't support web components anytime soon, Headless Chrome / Puppeteer should replace it in Jest as the defacto

@SimenB
Copy link
Member

SimenB commented Nov 27, 2018

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)

@jeremy-ww
Copy link

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

@JulioJu
Copy link

JulioJu commented Jan 22, 2020

There is https://github.com/hustcc/jest-electron ?

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests