summaryrefslogtreecommitdiff
path: root/doc/ci/unit_test_reports.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/ci/unit_test_reports.md')
-rw-r--r--doc/ci/unit_test_reports.md38
1 files changed, 38 insertions, 0 deletions
diff --git a/doc/ci/unit_test_reports.md b/doc/ci/unit_test_reports.md
index b9c1809bf0d..0a1f0000969 100644
--- a/doc/ci/unit_test_reports.md
+++ b/doc/ci/unit_test_reports.md
@@ -244,6 +244,44 @@ Test:
- ./**/*test-result.xml
```
+### JavaScript example
+
+There are a few tools that can produce JUnit report format XML files in JavaScript.
+
+#### Jest
+
+The [jest-junit](https://github.com/jest-community/jest-junit) npm package can generate test reports for JavaScript applications.
+In the following `.gitlab-ci.yml` example, the `javascript` job uses Jest to generate the test reports:
+
+```yaml
+javascript:
+ stage: test
+ script:
+ - 'jest --ci --reporters=default --reporters=jest-junit'
+ artifacts:
+ when: always
+ reports:
+ junit:
+ - junit.xml
+```
+
+#### Karma
+
+The [Karma-junit-reporter](https://github.com/karma-runner/karma-junit-reporter) npm package can generate test reports for JavaScript applications.
+In the following `.gitlab-ci.yml` example, the `javascript` job uses Karma to generate the test reports:
+
+```yaml
+javascript:
+ stage: test
+ script:
+ - karma start --reporters junit
+ artifacts:
+ when: always
+ reports:
+ junit:
+ - junit.xml
+```
+
## Viewing Unit test reports on GitLab
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/24792) in GitLab 12.5 behind a feature flag (`junit_pipeline_view`), disabled by default.