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

🚀 Feature: Use process.browser to detect environment #1764

Open
limdauto opened this issue Jun 25, 2015 · 6 comments
Open

🚀 Feature: Use process.browser to detect environment #1764

limdauto opened this issue Jun 25, 2015 · 6 comments
Labels
status: accepting prs Mocha can use your help with this one! type: cleanup a refactor type: feature enhancement proposal

Comments

@limdauto
Copy link

I think it's generally accepted that to check whether an environment is node or browser, we should type check window, instead of document, because sometimes document is mocked for testing purpose.

@jbnicolai
Copy link

I'd rather use process.browser, see https://github.com/mochajs/mocha/blob/master/lib/utils.js#L690

If you'd like to open a PR for this, please do!

@boneskull
Copy link
Contributor

process.browser please. I tend to stub window when unit testing my browserified code on the server.

@ndhoule
Copy link
Contributor

ndhoule commented Jul 5, 2015

Yeah, process.browser is the way to go. #1727 changed a bunch of these env checks to use process.browser, but I pretty much did the bare minimum to get it working so I'm sure there are more.

@boneskull boneskull changed the title Type check window instead of document to detect environment ~~Type check window instead of document to detect environment~~ use process.browser to detect environment Jul 5, 2015
@boneskull boneskull changed the title ~~Type check window instead of document to detect environment~~ use process.browser to detect environment use process.browser to detect environment Jul 5, 2015
@boneskull boneskull added the status: accepting prs Mocha can use your help with this one! label Jul 5, 2015
@stale
Copy link

stale bot commented Oct 17, 2017

I am a bot that watches issues for inactivity.
This issue hasn't had any recent activity, and I'm labeling it stale. In 14 days, if there are no further comments or activity, I will close this issue.
Thanks for contributing to Mocha!

@stale stale bot added the stale this has been inactive for a while... label Oct 17, 2017
@boneskull boneskull added type: feature enhancement proposal and removed stale this has been inactive for a while... labels Oct 17, 2017
anmuel added a commit to anmuel/mocha that referenced this issue Apr 7, 2018
anmuel added a commit to anmuel/mocha that referenced this issue Apr 7, 2018
@anmuel
Copy link

anmuel commented Apr 7, 2018

I'd like to contribute here :)
Was the mentioned TODO the only place to look at? (I doubt it)

@boneskull
Copy link
Contributor

@anmuel Thanks. You could grep around for window or document and see if there's anything else that needs addressing, but that's about all I know of right now.

@boneskull boneskull added semver-minor implementation requires increase of "minor" version number; "features" type: cleanup a refactor and removed type: feature enhancement proposal semver-minor implementation requires increase of "minor" version number; "features" labels Apr 7, 2018
@JoshuaKGoldberg JoshuaKGoldberg changed the title use process.browser to detect environment 🚀 Feature: Use process.browser to detect environment Dec 27, 2023
@JoshuaKGoldberg JoshuaKGoldberg added the type: feature enhancement proposal label Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Mocha can use your help with this one! type: cleanup a refactor type: feature enhancement proposal
Projects
None yet
Development

No branches or pull requests

6 participants