Skip to content

Commit babbd6b

Browse files
committed
expand CONTRIBUTING.md; closes mochajs#2542 [ci skip]
1 parent 47ba479 commit babbd6b

File tree

1 file changed

+61
-26
lines changed

1 file changed

+61
-26
lines changed

CONTRIBUTING.md

Lines changed: 61 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,84 @@
11
# Contributing to Mocha
22

3-
Hi! We could use your help. Let us help you help us. Or something.
3+
> Please read these guidelines before submitting an issue, filing a feature request, or contributing code.
44
5-
## General
5+
## :question: Got a Question?
66

7-
1. If you are looking for a place to begin, **please send PRs for bugfixes instead of new features**, and/or **look for issues labeled `PR PLEASE`.**
7+
If you have a question about using Mocha, please use the [mailing list](https://groups.google.com/group/mochajs), [StackOverflow](https://stackoverflow.com), or ask the friendly people in our [chat room](https://gitter.im/mochajs/mocha).
88

9-
2. **Help with documentation and the wiki is always appreciated**.
9+
## :bug: I Found a Bug
1010

11-
3. Please **be courteous and constructive** when commenting on issues, commits, and pull requests.
11+
Sorry! It happens to the best of us. If you've found a bug in Mocha, **please [search](https://github.com/mochajs/mocha/issues/) to see if it's already been reported**. Otherwise, create a [new issue](https://github.com/mochajs/mocha/issues/new). If you can fix the bug yourself, feel free to create a [pull request](#propose-a-change) thereafter.
1212

13-
## Bug Reports & Issues
13+
Please include *as much detail as possible* to help us reproduce and diagnose the bug. Most importantly:
1414

15-
1. When reporting a bug, please **provide steps to reproduce**. If possible, show code.
16-
17-
2. Please **show all code in JavaScript**. We don't all read `<insert-language-that-compiles-to-JavaScript-here>`. If you do not, you will be asked to.
15+
- Let us know *how* you're running Mocha (options, flags, environment, browser or Node.js, etc.)
16+
- Include your test code or file(s). If large, please provide a link to a repository or [gist](https://gist.github.com).
17+
- Please show code in JavaScript only (any version)
1818

19-
3. Because Mocha works with many third-party libraries and tools, **ensure the bug you are reporting is actually within Mocha**.
19+
If we need more information from you, we'll let you know. If you don't within a reasonable time frame (TBD), your issue will be automatically closed for inactivity.
2020

21-
4. If you report a bug, and it is inactive for a significant amount of time, it may be closed. **Please respond promptly to requests for more information**.
21+
## :exclamation: Propose a Change
2222

23-
## Pull Requests
23+
Before you get your hands dirty, please [search](https://github.com/mochajs/mocha/issues/) for a related issue, or [create a new one](https://github.com/mochajs/mocha/issues/new). If you wish to contribute a new feature, this is doubly important! Let's discuss your proposed changes first; we don't want you to waste time implementing a change that is at odds with the project's direction. That said, we'll happily consider any contribution, no matter how great or small.
2424

25-
1. Before sending a large PR, it's recommended to **create an issue to propose the change**. Nobody wants to write a book of code and throw it away.
25+
*This paragraph would contain information about Mocha's roadmap, but it doesn't yet exist.* :poop:
2626

27-
2. Because Mocha should be kept as maintainable as possible, its codebase must be kept slim. Historically, *most PRs for new features are not merged*. New features inevitably increase the size of the codebase, and thus reduce maintainability. Only features *deemed essential* are likely to be merged--this is at the discretion of the maintainer(s). If your PR for a feature is not merged, this doesn't necessarily mean your PR was a bad idea, wouldn't be used, or otherwise sucks. It just means **only essential PRs for new features are likely to be merged**.
27+
It's also important to understand some overarching goals of Mocha, detailed below.
2828

29-
3. Due to the above, before creating a PR for a new feature, **create an issue to propose the feature.**
29+
### :soccer: About Project Goals
3030

31-
4. Please **respect existing coding conventions**, whatever those may be.
31+
Mocha is a test framework. Developers use it against anything from legacy spaghetti in IE7 to stage-0 TC39 features in Electron. While still staying current, Mocha will only drop support for old platforms as a last resort. If and only if Mocha cannot move forward as a project, support will be dropped. If workarounds exist, they are preferred.
3232

33-
5. If your PR has been waiting in limbo for some time, it's very helpful to **rebase against master**, which will make it easier to merge.
33+
Mocha adheres strictly to [semantic versioning](https://semver.org). We are *extremely cautious* with changes that have the potential to break; given the size of Mocha's user base, it's *highly unlikely* a breaking change will slide by.
3434

35-
6. Please **add tests for new code**.
35+
Mocha's usage far outweighs its resources. If a proposed feature would incur a maintenance penalty, it could be a hard sell.
3636

37-
7. **Always run `npm test` before sending a PR.** If you break the tests, your PR will not be accepted until they are fixed.
37+
We ask you please keep these goals in mind when making or proposing changes.
3838

39-
## Source Control
39+
### :shoe: Contributing Code: Step-by-Step
4040

41-
1. Please **squash your commits** when sending a pull request. If you are unfamiliar with this process, see [this guide](https://help.github.com/articles/about-git-rebase/). If you have already pushed your changesets and are squashing thereafter, this may necessitate the use of a "force push". Please [read the docs](http://git-scm.com/docs/git-push) before you attempt this.
42-
43-
2. Please **follow the commit message conventions [outlined here](https://medium.com/code-adventures/git-conventions-a940ee20862d).**
41+
Follow these steps to get going. If you are having trouble, don't be afraid to [ask for help](#got-a-question).
4442

45-
## TL;DR
43+
1. [Install Node.js 4.x or newer](https://nodejs.org/download).
44+
1. Install [GNU Make](https://www.gnu.org/software/make/) or equivalent.
45+
1. Follow [Github's documentation](https://help.github.com/articles/fork-a-repo/) on setting up Git, forking and cloning.
46+
1. Create a new branch in your working copy. Give your branch a descriptive name, such as `issue/12345`: `git checkout -b issue/12345`.
47+
1. Execute `npm install` to install the development dependencies.
48+
1. Make your changes and add them via `git add`.
49+
- **Do not modify** the root `mocha.js` file directly; it is automatically generated.
50+
- Your changes will likely be somewhere in `lib/`, `bin/` or `browser-entry.js` if your changes are browser-specific.
51+
- Please add unit and/or integration tests (depending on the nature of your changes).
52+
- Keep your PR focused. Don't fix two things at once, or make formatting changes alongside bug fixes.
53+
1. Before committing, run `npm test`.
54+
- This will run unit tests, Node.js and browser integration tests, and lint the source code.
55+
- The "browser" tests use Mocha to test itself; it will rebuild the root `mocha.js` file with your changes.
56+
- **Please avoid committing changes to `mocha.js`**.
57+
- Ultimately, your pull request will be built on our continuous integration servers ([Travis CI](https://travis-ci.org/mochajs/mocha) and [AppVeyor](https://ci.appveyor.com/project/boneskull/mocha)). The first step to ensuring these checks pass is to test on your own machine.
58+
1. Commit your changes.
59+
- Use a brief message on the first line, referencing a relevant issue (e.g. `#12345`).
60+
- Add detail in subsequent lines.
61+
1. Push your changes to your fork.
62+
1. Navigate to the source repository. You should see a notification about your recent changes in your fork's branch, with a button to create a pull request. Click it.
63+
1. Describe your changes in detail here. Once you're satisfied, submit the form.
64+
- *PRO TIP*: If you've used a multi-line commit message, Github will pre-fill the PR's description with it.
65+
1. If you have not signed our Contributor License Agreement, a friendly robot will prompt you to do so. A CLA (electronic) signature is **required** for all contributions of code to Mocha.
66+
1. CI will run against your changes.
67+
- If the changes fail the checks, you will need to address those before merging.
68+
- You don't need to make a new PR to make changes. Instead, commit on top of your changes, and push these to your fork's branch. The PR will be updated, and CI will re-run.
69+
- Github will indicate if there's a conflict. If this happens, you will need to [rebase](https://help.github.com/articles/about-git-rebase/) your branch onto the `master` branch of the source repository. *Don't merge.*
70+
- It's no longer necessary to "squash" your changes.
71+
1. Be patient while your PR is reviewed. This can take awhile ([why?](https://github.com/orgs/mochajs/projects/4)). We may request changes; don't be afraid to question them.
4672

47-
**Be kind, be diligent, look before you leap into a PR, and follow common community conventions**.
73+
## :angel: I Just Want To Help
4874

49-
*- The Mocha Team*
75+
*Excellent.* Here's how:
76+
77+
- **Handy with JavaScript?** Please check out the issues labeled [`pr-please`](https://git.io/vXYu2).
78+
- **Can you write good (and do other stuff good too)?** Help with the documentation. See the [issues for our site](https://github.com/mochajs/mochajs.github.io/issues).
79+
- **Design your thing?** [Our site](https://github.com/mochajs/mochajs.github.io) needs your magic touch.
80+
- **Know Mocha's codebase?** We could use your help triaging issues and/or reviewing pull requests. Please contact an [org member](https://github.com/mochajs/people), and we'll chat.
81+
- **Want to build our community?** Mocha has a *lot* of users. We could use your help bringing everyone together in peace and harmony. Please contact an [org member](https://github.com/mochajs/people).
82+
- **You can sell dirt to worms?** Let's raise Mocha's profile in the JavaScript and OSS communities. Please contact an [org member](https://github.com/mochajs/people)!
83+
- **Wait--you write unit tests for *fun*?** A PR which increases coverage is unlikely to be turned down.
84+
- **Are you experienced?** If you're a seasoned Mocha user, why not help answer some questions in the [chat room](https://gitter.im/mochajs/mocha)?

0 commit comments

Comments
 (0)