-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
55 lines (46 loc) · 1.52 KB
/
.gitlab-ci.yml
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
default:
image: node:19
stages:
- test
test:
stage: test
script:
# Skip this line if not installing your own Node.js packages
- npm ci --cache .npm --prefer-offline
# Install Testmo CLI tool locally (then use npx testmo .. to run it)
- npm install --cache .npm --prefer-offline --no-save @testmo/testmo-cli
# Optionally add a couple of fields such as the git hash and link to the build
- npx testmo automation:resources:add-field --name git --type string
--value $CI_COMMIT_SHORT_SHA --resources resources.json
- npx testmo automation:resources:add-link --name build
--url $CI_PIPELINE_URL --resources resources.json
# Check if the required variables are available
- >
if [[ -z "${TESTMO_URL}" ]]; then
echo "The TESTMO_URL secret is not defined for this repository"
exit 1
fi
if [[ -z "${TESTMO_TOKEN}" ]]; then
echo "The TESTMO_TOKEN secret is not defined for this repository"
exit 1
fi
# Run automated tests and report results to Testmo
- npx testmo automation:run:submit
--instance "$TESTMO_URL"
--project-id 1
--name "Mocha test run"
--source "unit-tests"
--resources resources.json
--results results/*.xml
-- npm run mocha-junit # Note space after --
cache:
- key:
files:
- package-lock.json
paths:
- .npm/
artifacts:
when: always
reports:
junit:
- results/mocha-test-results.xml