diff options
Diffstat (limited to '.github')
-rw-r--r-- | .github/CONTRIBUTING.md | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 47129ea74..74d20aa78 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md | |||
@@ -175,43 +175,12 @@ $ npm run dev -- --ar-locale | |||
175 | 175 | ||
176 | ### Testing | 176 | ### Testing |
177 | 177 | ||
178 | #### Unit/integration tests | ||
179 | |||
178 | Your code contributions must pass the tests before they can be merged. Tests ensure most of the application behaves | 180 | Your code contributions must pass the tests before they can be merged. Tests ensure most of the application behaves |
179 | 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. | 181 | 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. |
180 | 182 | ||
181 | PeerTube mainly features backend and plugin tests, found in `server/tests`. | 183 | See the [dedicated documentation](/support/doc/development/tests.md) to run tests locally. |
182 | |||
183 | #### Unit tests | ||
184 | |||
185 | Create a PostgreSQL user **with the same name as your username** in order to avoid using the *postgres* user. | ||
186 | |||
187 | Then, we can create the databases (if they don't already exist): | ||
188 | |||
189 | ``` | ||
190 | $ sudo -u postgres createuser you_username --createdb --superuser | ||
191 | $ npm run clean:server:test | ||
192 | ``` | ||
193 | |||
194 | Build the application and run the unit/integration tests: | ||
195 | |||
196 | ``` | ||
197 | $ npm run build -- --light | ||
198 | $ npm test | ||
199 | ``` | ||
200 | |||
201 | If you just want to run 1 test (which is what you want to debug a specific test rapidly): | ||
202 | |||
203 | ``` | ||
204 | $ TS_NODE_FILES=true npm run mocha -- --exit -r ts-node/register -r tsconfig-paths/register --bail server/tests/api/videos/single-server.ts | ||
205 | ``` | ||
206 | |||
207 | While testing, you might want to display a server's logs: | ||
208 | |||
209 | ``` | ||
210 | NODE_APP_INSTANCE=1 NODE_ENV=test npm run parse-log -- --level debug | less +GF | ||
211 | ``` | ||
212 | |||
213 | Instance configurations are in `config/test-{1,2,3,4,5,6}.yaml`. | ||
214 | Note that only instance 2 has transcoding enabled. | ||
215 | 184 | ||
216 | #### Testing the federation of PeerTube servers | 185 | #### Testing the federation of PeerTube servers |
217 | 186 | ||