diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 704b22b8b..2af5c236a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -63,8 +63,12 @@ It is not hosted on GitHub but on [Framasoft](https://framasoft.org/)'s own [Git ## Develop -Don't hesitate to talk about features you want to develop by creating/commenting an issue -before you start working on them :). +Always talk about features you want to develop by creating/finding and commenting the issue tackling your problem +before you start working on it, and inform the community that you begin coding by claiming the issue. + +Once you are ready to show your code to ask for feedback, submit a *draft* Pull Request. +Once you are ready for a code review before merge, submit a Pull Request. In any case, please +link your PR to the issues it solves by using the GitHub syntax: "fixes #issue_number". ### Prerequisites @@ -160,7 +164,41 @@ and the web server is automatically restarted. $ npm run dev ``` -### Testing the federation of PeerTube servers +### Testing + +Your code contributions must pass the tests before they can be merged. Tests ensure most of the application behaves +as expected and respect the syntax conventions. They will run upon PR submission as part of our CI, but running them beforehand yourself will get you faster feedback and save CI runner time for others. + +PeerTube mainly features backend and plugin tests, found in `server/tests`. + +#### Unit tests + +Create a PostgreSQL user **with the same name as your username** in order to avoid using the *postgres* user. + +Then, we can create the databases (if they don't already exist): + +``` +$ sudo -u postgres createuser you_username --createdb --superuser +$ npm run clean:server:test +``` + +Build the application and run the unit/integration tests: + +``` +$ npm run build -- --light +$ npm test +``` + +If you just want to run 1 test (which is what you want to debug a specific test rapidly): + +``` +$ npm run mocha -- --exit -r ts-node/register -r tsconfig-paths/register --bail server/tests/api/index.ts +``` + +Instance configurations are in `config/test-{1,2,3,4,5,6}.yaml`. +Note that only instance 2 has transcoding enabled. + +#### Testing the federation of PeerTube servers Create a PostgreSQL user **with the same name as your username** in order to avoid using the *postgres* user. Then, we can create the databases (if they don't already exist): @@ -188,33 +226,6 @@ with the `root` as username and `test{1,2,3}` for the password. Instance configurations are in `config/test-{1,2,3}.yaml`. -### Unit tests - -Create a PostgreSQL user **with the same name as your username** in order to avoid using the *postgres* user. - -Then, we can create the databases (if they don't already exist): - -``` -$ sudo -u postgres createuser you_username --createdb --superuser -$ npm run clean:server:test -``` - -Build the application and run the unit/integration tests: - -``` -$ npm run build -- --light -$ npm test -``` - -If you just want to run 1 test: - -``` -$ npm run mocha -- --exit -r ts-node/register -r tsconfig-paths/register --bail server/tests/api/index.ts -``` - -Instance configurations are in `config/test-{1,2,3,4,5,6}.yaml`. -Note that only instance 2 has transcoding enabled. - ### Emails To test emails with PeerTube: