-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Docs: migrate HOW-TO wiki pages to main documentation #5463
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
base: main
Are you sure you want to change the base?
Conversation
Migrate 3 HOW-TO wiki pages to both docs systems: - HOW-TO: Correctly stub stdout - HOW-TO: Use environment variables - Mess with globals Part of mochajs#5248 wiki migration effort
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip: please make sure the site builds before sending a PR 🙂
@@ -0,0 +1,36 @@ | |||
--- | |||
description: Learn how to use environment variables in Mocha tests | |||
title: HOW-TO: Use environment variables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get a build error on this and the other HOW-TO
file:
docs → explainers/environment-variables.mdx frontmatter does not match collection schema.
title: Required
The title:
frontmatter is indeed invalid. You'll need to escape it with quotes. The :
is getting interpreted as invalid YML.
title: "HOW-TO: Use environment variables"
That being said, I don't think there's any need to keep to the HOW-TO
. All of these "Explainers" section pages are variants of "how to" guides. So, I would say it should match the existing titles convention:
title: HOW-TO: Use environment variables | |
title: Environment variables |
Any issues or questions please contact us on Gitter. | ||
|
||
Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much copypasta 🍝
Any issues or questions please contact us on Gitter. | |
Thanks |
title: HOW-TO: Use environment variables | ||
--- | ||
|
||
Sometimes you might want your test to make use of variables set on an environment-level. Common reasons for this include |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes you might want your test to make use of variables set on an environment-level. Common reasons for this include | |
Sometimes you might want your test to make use of variables set on an environment-level. Common reasons for this include: |
@@ -0,0 +1,57 @@ | |||
--- | |||
description: How to work with global variables in Mocha tests | |||
title: Mess with globals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Mess with" is fun phrasing, but these days we're more ... cleaned up.
title: Mess with globals | |
title: Globals |
--- | ||
Related issue [#1582](https://github.com/mochajs/mocha/issues/1582) | ||
|
||
If your test messes with globals, a reasonable expectation is that you will clean up after yourself. This is not impossible in the case of `process.stdout.write()` or `console.log()`. In fact, it's pretty easy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is just moving code over, but we shouldn't say things are "easy".
If your test messes with globals, a reasonable expectation is that you will clean up after yourself. This is not impossible in the case of `process.stdout.write()` or `console.log()`. In fact, it's pretty easy. | |
If your test manipulates globals, a reasonable expectation is that you will clean up after yourself. This includes commonly called methods such as `process.stdout.write()` or `console.log()`. |
PR Checklist
status: accepting prs
Overview
Migrate 3 HOW-TO wiki pages to both docs systems:
Part of #5248 wiki migration effort