Welcome to mirror list, hosted at ThFree Co, Russian Federation.

testing.md « doc - gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 15da6cf00934beb84028709b441bbbaa0886ed87 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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).

## Troubleshooting

### `untamper-my-lockfile` fails when the integrity checksum hashes are different

In case the [`untamper-my-lockfile` job fails](https://gitlab.com/gitlab-org/gitlab-docs/-/jobs/2460255126)
due to a hash mismatch,
[update the checksums](https://classic.yarnpkg.com/en/docs/cli/install#toc-yarn-install-update-checksums)
of `yarn.lock`:

```shell
rm yarn.lock
yarn install --update-checksums
```