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

Browser-only environment #3452

Closed
strctr opened this issue May 3, 2017 · 5 comments
Closed

Browser-only environment #3452

strctr opened this issue May 3, 2017 · 5 comments

Comments

@strctr
Copy link

strctr commented May 3, 2017

I want request a feature:

  • It is possible to simulate browser-only environment in Jest?
  • Or it is possible to select node/browser/shared-node-browser env for specific test/test-case?
@strctr strctr changed the title Browser-only environment. Browser-only environment May 3, 2017
@thymikee
Copy link
Collaborator

thymikee commented May 3, 2017

Look over here: #3421

@strctr
Copy link
Author

strctr commented May 3, 2017

Right now jest provide node env out of the box and browser like env with jsdom. I see this feature like enable/disable specific globals before test.

In a code this can look like following:

// default {node: true, browser: true}
jest.setEnvinroment({node: false, browser: true});

// code bellow can't use node specific functions
...

@cpojer
Copy link
Member

cpojer commented May 3, 2017

In the next release of Jest, you can do @jest-environment node in the docblock header of your file.

@cpojer cpojer closed this as completed May 3, 2017
@strctr
Copy link
Author

strctr commented May 3, 2017

Cool, thanks!

@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 13, 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

3 participants