| 1 | # Contributing to jsonpath-compliance-test-suite |
| 2 | |
| 3 | The jsonpath-compliance-test-suite project team welcomes contributions from the community. |
| 4 | |
| 5 | ## Contribution Flow |
| 6 | |
| 7 | This is a rough outline of what a contributor's workflow looks like: |
| 8 | |
| 9 | - Create a topic branch from where you want to base your work |
| 10 | - Make commits of logical units |
| 11 | - Make sure your commit messages are in the proper format (see below) |
| 12 | - Push your changes to a topic branch in your fork of the repository |
| 13 | - Submit a pull request |
| 14 | |
| 15 | Example: |
| 16 | |
| 17 | ``` shell |
| 18 | git remote add upstream https://github.com/jsonpath-standard/jsonpath-compliance-test-suite.git |
| 19 | git checkout -b my-new-feature main |
| 20 | git commit -a |
| 21 | git push origin my-new-feature |
| 22 | ``` |
| 23 | |
| 24 | ### Making changes to the Test Suite |
| 25 | |
| 26 | You need to have [Node.js](https://nodejs.org/en/) (v18 or higher) installed to build the Test Suite. |
| 27 | |
| 28 | To add or modify tests: |
| 29 | - add/edit the corresponding file(s) in the `tests` directory |
| 30 | - [optional] run the `build.sh` or `build.ps1` script located in the root folder\ |
| 31 | (this will be performed automatically by GitHub CI after the pull request has been merged to `main`) |
| 32 | - commit the changes to `tests` and `cts.json` |
| 33 | |
| 34 | Do not modify `cts.json` directly! |
| 35 | |
| 36 | ### Staying In Sync With Upstream |
| 37 | |
| 38 | When your branch gets out of sync with the jsonpath-standard/jsonpath-compliance-test-suite/main branch, use the following to update: |
| 39 | |
| 40 | ``` shell |
| 41 | git checkout my-new-feature |
| 42 | git fetch -a |
| 43 | git pull --rebase upstream main |
| 44 | git push --force-with-lease origin my-new-feature |
| 45 | ``` |
| 46 | |
| 47 | ### Updating pull requests |
| 48 | |
| 49 | If your PR fails to pass CI or needs changes based on code review, you'll most likely want to squash these changes into |
| 50 | existing commits. |
| 51 | |
| 52 | If your pull request contains a single commit or your changes are related to the most recent commit, you can simply |
| 53 | amend the commit. |
| 54 | |
| 55 | ``` shell |
| 56 | git add . |
| 57 | git commit --amend |
| 58 | git push --force-with-lease origin my-new-feature |
| 59 | ``` |
| 60 | |
| 61 | If you need to squash changes into an earlier commit, you can use: |
| 62 | |
| 63 | ``` shell |
| 64 | git add . |
| 65 | git commit --fixup <commit> |
| 66 | git rebase -i --autosquash main |
| 67 | git push --force-with-lease origin my-new-feature |
| 68 | ``` |
| 69 | |
| 70 | Be sure to add a comment to the PR indicating your new changes are ready to review, as GitHub does not generate a |
| 71 | notification when you git push. |
| 72 | |
| 73 | ### Formatting Commit Messages |
| 74 | |
| 75 | We follow the conventions on [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/). |
| 76 | |
| 77 | Be sure to include any related GitHub issue references in the commit message. See |
| 78 | [GFM syntax](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown) for referencing issues |
| 79 | and commits. |
| 80 | |
| 81 | ## Reporting Bugs and Creating Issues |
| 82 | |
| 83 | When opening a new issue, try to roughly follow the commit message format conventions above. |