blob: bb0e5497780eb43a12c651ee897942ab4ea5164b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# Testing the GitLab docs site
Before any changes to the `gitlab-docs` project are merged, they are tested in a merge request's
CI/CD pipeline. The pipeline configuration is in the [`.gitlab-ci.yml`](../.gitlab-ci.yml) file.
You can [run the same tests locally](#run-tests-locally), before pushing your changes
to the project.
## What do we test?
| Test target | Tool | Purpose |
| ------------ | ----------- | ------------------- |
| CSS | Stylelint | Code quality |
| Dockerfiles | Hadolint | Syntax checks |
| JavaScript | ESLint | Syntax checks |
| JavaScript | Prettier | Code formatting |
| Links | Nanoc check | Find broken links |
| Ruby | RSpec | Unit tests |
| Vue | Jest | Unit tests |
| YAML | yamllint | Syntax checks |
## Run tests locally
You must install the dependencies before you can run tests locally:
- node modules: `yarn install`
- Ruby gems: `bundle install`
- hadolint (MacOS: `brew install hadolint`)
- yamllint (MacOS: `brew install yamllint`)
To run the tests:
`make test`
### Lefthook
Optionally, you can use Lefthook to automatically run tests before pushing code.
Install Lefthook with `lefthook install`, then the tests run each time you run a
`git push` command
Lefthook settings are configured in [`lefthook.yml`](../lefthook.yml).
|