|
1 |
| -# Contributing to the Parse JavaScript SDK |
| 1 | +# Contributing to the Parse JavaScript SDK <!-- omit in toc --> |
2 | 2 |
|
3 |
| -We want to make contributing to this project as easy and transparent as possible. |
| 3 | +- [Preparation for Contributing](#preparation-for-contributing) |
| 4 | + - [Recommended Tools](#recommended-tools) |
| 5 | + - [Set-up Your Local Machine](#set-up-your-local-machine) |
| 6 | + - [Building the SDK](#building-the-sdk) |
| 7 | + - [Testing](#testing) |
| 8 | + - [Unit Tests](#unit-tests) |
| 9 | + - [Integration Tests](#integration-tests) |
| 10 | + - [TypeScript Tests](#typescript-tests) |
| 11 | + - [Pull Requests](#pull-requests) |
| 12 | +- [Issues](#issues) |
| 13 | + - [Known Issues](#known-issues) |
| 14 | + - [Report New Issue](#report-new-issue) |
| 15 | + - [Security Bugs](#security-bugs) |
| 16 | +- [Coding Style](#coding-style) |
| 17 | +- [Code of Conduct](#code-of-conduct) |
4 | 18 |
|
5 |
| -If you're looking to get started, but want to ease yourself into the codebase, look for issues tagged [good first task](https://github.com/parse-community/Parse-SDK-JS/labels/good%20first%20task). These are simple yet valuable tasks that should be easy to get started. |
| 19 | +We want to make contributing to this project as easy and transparent as possible. If you're looking to get started, but want to ease yourself into the codebase, look for [open issues](https://github.com/parse-community/Parse-SDK-JS/issues). |
6 | 20 |
|
7 |
| -## `master` is unsafe |
| 21 | +## Preparation for Contributing |
8 | 22 |
|
9 |
| -Our goal is to keep `master` stable, but there may be changes that your application may not be compatible with. We'll do our best to publicize any breaking changes, but try to use our specific releases in any production environment. |
| 23 | +### Recommended Tools |
10 | 24 |
|
11 |
| -## Setting up the project for debugging and contributing: |
| 25 | +- [Visual Studio Code](https://code.visualstudio.com), a popular IDE. |
| 26 | +- [Jest Extension](https://marketplace.visualstudio.com/items?itemName=Orta.vscode-jest) the Jest extension for VSC to run the tests inline and debug quicky. |
| 27 | +- [Jasmine Test Explorer Extension](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer), a very practical test exploration plugin which let you run, debug and see the test results inline. |
| 28 | +- [mongodb-runner](https://github.com/mongodb-js/runner) Easily install and run MongoDB to test your code against it. Install with `npm install -g mongodb-runner`. |
12 | 29 |
|
13 |
| -### Recommended setup: |
| 30 | +### Set-up Your Local Machine |
14 | 31 |
|
15 |
| -* [vscode](https://code.visualstudio.com), the popular IDE. |
16 |
| -* [Jest Extension](https://marketplace.visualstudio.com/items?itemName=Orta.vscode-jest) the Jest extension for vscode to run the tests inline and debug quicky. |
17 |
| -* [Jasmine Test Explorer Extension](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer), a very practical test exploration plugin which let you run, debug and see the test results inline. |
18 |
| -* [mongodb-runner](https://github.com/mongodb-js/runner) Easily install and run MongoDB to test your code against it. (install with `npm install -g mongodb-runner`) |
19 |
| - |
20 |
| -### Setting up you local machine: |
21 |
| - |
22 |
| -* [Fork](https://github.com/parse-community/Parse-SDK-JS) this project and clone the fork on your local machine: |
| 32 | +- [Fork](https://github.com/parse-community/Parse-SDK-JS) this repository and clone it on your local machine: |
23 | 33 |
|
24 | 34 | ```sh
|
25 | 35 | $ git clone https://github.com/parse-community/Parse-SDK-JS
|
26 |
| -$ cd Parse-SDK-JS # go into the clone directory |
27 |
| -$ npm install # install all the node dependencies |
28 |
| -$ code . # launch vscode |
| 36 | +$ cd Parse-SDK-JS |
| 37 | +$ npm install |
| 38 | +$ code . |
29 | 39 | ```
|
30 | 40 |
|
31 | 41 | ### Building the SDK
|
32 | 42 |
|
33 | 43 | The Parse JS SDK is built for three platforms:
|
34 | 44 |
|
35 |
| -- The browser |
36 |
| -- nodejs |
37 |
| -- react-native |
38 |
| - |
39 |
| -When developing the SDK you can use `npm run watch` in order to rebuild your changes upon each save. |
| 45 | +- Browser |
| 46 | +- NodeJS |
| 47 | +- React Native |
40 | 48 |
|
41 |
| -By default, the watch command will rebuild the SDK for the browser platform. The following commands will rebuild changes for a specific platform. |
| 49 | +When developing the SDK run `npm run watch` in order to rebuild your changes automatically upon each save. By default, the watch command will rebuild the SDK only for the browser platform. The following commands will rebuild changes for a specific platform: |
42 | 50 |
|
43 | 51 | - `npm run watch:node`
|
44 | 52 | - `npm run watch:browser`
|
45 | 53 | - `npm run watch:react-native`
|
46 | 54 |
|
47 |
| -### Testing the code |
| 55 | +### Testing |
48 | 56 |
|
49 |
| -The SDK is tested through two lenses. unit tests are run with jest and integration tests with jasmine. |
| 57 | +The SDK is tested through two lenses. unit tests are run with jest and integration tests with jasmine. Two different frameworks are used as the integration tests leverage a stateful server, with the data saved into the database, and Jest is running many tests in parallel, which makes it incompatible with our integration tests. |
50 | 58 |
|
51 |
| -Two different frameworks are used as the integration tests leverage a stateful server, with the data saved into the database, and Jest is running many tests in parallel, which makes it incompatible with our integration tests. |
52 |
| - |
53 |
| -#### Unit tests |
| 59 | +#### Unit Tests |
54 | 60 |
|
55 | 61 | Those tests are located in [/src/\_\_tests\_\_](/src/__tests__) and are responsible for ensuring each class is behaving as expected, without considering the rest of the system. For example, adding a new query helper function would probably require to add relevant tests that ensure the query is properly serialized to a valid Parse REST query object. Unit tests heavily leverage mocking and are an essential part of our testing harness.
|
56 | 62 |
|
57 | 63 | To run unit tests, run `npm test`. If you have the vscode Jest plugin extension (as recommended), you can run your tests by clicking the *Debug* lens that appears near by the test.
|
58 | 64 |
|
59 |
| -#### Integration tests |
| 65 | +#### Integration Tests |
60 | 66 |
|
61 | 67 | Those tests are located in [/integration/test](/integration/test) and are responsible for ensuring a proper communication with parse-server. With the integration tests, we ensure all communications between the SDK and the server are behaving accordingly.
|
62 | 68 |
|
63 | 69 | To run the integration tests, you will need a valid mongodb running on your local machine. You can get easily mongodb running with `mongodb-runner` (see [Recommended setup](#recommended-setup)).
|
64 | 70 |
|
65 | 71 | Use `npm run integration` in order to run the integration tests. If you have the vscode Jasmine extension installed (as recommended), you can run your tests by clicking the *Run* or the *Debug* lens that appears near by the test.
|
66 | 72 |
|
| 73 | +#### TypeScript Tests |
| 74 | + |
| 75 | +Type tests are located in [/types/tests.ts](/types/tests.ts) and are responsible for ensure types generated for each class is behaving as expected. Types must be generated using `npm run build:types` and should not be manually changed. These types are `.d.ts` files located in [/types](/types). |
| 76 | + |
| 77 | +When developing type definitions you can use `npm run watch:ts` in order to rebuild your changes automatically upon each save. |
| 78 | + |
| 79 | +Use `npm run test:types` in order to run types tests against generated `.d.ts` files. |
| 80 | + |
67 | 81 | ### Pull Requests
|
68 | 82 |
|
69 |
| -We actively welcome your pull requests. When we get one, we'll run some Parse-specific integration tests on it first. From here, we'll need to get a core member to sign off on the changes and then merge the pull request. For API changes we may need to fix internal uses, which could cause some delay. We'll do our best to provide updates and feedback throughout the process. |
| 83 | +We appreciate your contribution and welcome your pull requests. When submitting a pull request, the CI will run some automated tests on it. From here, we'll need to get a core member to sign off on the changes and then merge the pull request. We'll do our best to provide updates and feedback throughout the process. |
70 | 84 |
|
71 |
| -1. Fork the repo and create your branch from `master`. |
| 85 | +1. Fork the repo and create your branch from `alpha`. |
72 | 86 | 2. Add unit tests for any new code you add.
|
73 |
| -3. If you've changed APIs, update the documentation. |
74 |
| -4. Ensure the test suite passes. (run `npm test && npm run integration`) |
75 |
| -5. Make sure your code lints. |
| 87 | +3. If you've changed public APIs, update the documentation. |
| 88 | +4. Ensure the test suite passes by running `npm test && npm run integration`. |
| 89 | +5. Make sure your code lints by running `npm run lint`. |
| 90 | + |
| 91 | +## Issues |
76 | 92 |
|
77 | 93 | ### Known Issues
|
78 | 94 |
|
79 | 95 | We use GitHub issues to track public bugs. We will keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new issue, try to make sure your problem doesn't already exist.
|
80 | 96 |
|
81 |
| -### Reporting New Issues |
| 97 | +### Report New Issue |
82 | 98 |
|
83 |
| -Not all issues are SDK issues. If you're unsure whether your bug is with the SDK or backend, you can test to see if it reproduces with our [REST API][rest-api] and [Parse API Console][parse-api-console]. If it does, you can report backend bugs [here][bug-reports]. |
84 |
| -If the issue only reproduces with the JS SDK, you can [open an issue](https://github.com/parse-community/parse-server/issues) on this repository. |
85 |
| - |
86 |
| -Details are key. The more information you provide us the easier it'll be for us to debug and the faster you'll receive a fix. Some examples of useful tidbits: |
87 |
| - |
88 |
| -* A description. What did you expect to happen and what actually happened? Why do you think that was wrong? |
89 |
| -* A simple unit test that fails. Refer [here][tests-dir] for examples of existing unit tests and [here][integration-test-dir] for integration tests examples. See for how to setup your machine and run unit tests in [this](#setting-up-the-project-for-debugging-and-contributing) guide. You can submit a pull request with your failing unit test so that our CI verifies that the test fails. |
90 |
| -* What version does this reproduce on? What version did it last work on? |
91 |
| -* [Stacktrace or GTFO][stacktrace-or-gtfo]. In all honesty, full stacktraces with line numbers make a happy developer. |
92 |
| -* Anything else you find relevant. |
| 99 | +If you're unsure whether your bug is with the Pare JS SDK or Parse Server, you can test to see if it reproduces with the Parse Server [REST API](https://docs.parseplatform.org/rest/guide). |
93 | 100 |
|
94 | 101 | ### Security Bugs
|
95 | 102 |
|
96 | 103 | Parse Community has a [responsible Vulnerability Disclosure Program](https://github.com/parse-community/parse-server/blob/master/SECURITY.md) for the safe disclosure of security bugs. In those cases, please go through the process outlined on that page and do not file a public issue.
|
97 | 104 |
|
98 | 105 | ## Coding Style
|
99 | 106 |
|
100 |
| -* Most importantly, match the existing code style as much as possible. |
101 |
| -* We use ES6 for this codebase. Use modern syntax whenever possible. |
102 |
| -* Keep lines within 80 characters. |
103 |
| -* Always end lines with semicolons. |
| 107 | +- Most importantly, match the existing code style as much as possible. |
| 108 | +- We use ES6 for this codebase. Use modern syntax whenever possible. |
| 109 | +- Keep lines within 80 characters. |
| 110 | +- Always end lines with semicolons. |
104 | 111 |
|
105 |
| -### Code of Conduct |
| 112 | +## Code of Conduct |
106 | 113 |
|
107 | 114 | This project adheres to the [Contributor Covenant Code of Conduct](https://github.com/parse-community/parse-server/blob/master/CODE_OF_CONDUCT.md). By participating, you are expected to honor this code.
|
108 |
| - |
109 |
| -[google-group]: https://groups.google.com/forum/#!forum/parse-developers |
110 |
| -[stack-overflow]: http://stackoverflow.com/tags/parse-server |
111 |
| -[bug-reports]: https://github.com/parse-community/parse-server/issues |
112 |
| -[rest-api]: https://docs.parseplatform.org/rest/guide |
113 |
| -[parse-api-console]: http://blog.parseplatform.org/announcements/introducing-the-parse-api-console/ |
114 |
| -[stacktrace-or-gtfo]: http://i.imgur.com/jacoj.jpg |
115 |
| -[tests-dir]: /src/__tests__ |
116 |
| -[integration-test-dir]: /integration/test |
0 commit comments