Skip to content

Commit 9bba1e4

Browse files
committed
feat: better test reporting using Junit options
Changed the options for junit reporting to better organise the tests. Tests will now be displayed in Gitlab with the top-level describe, test name, and file path.
1 parent d6b3a64 commit 9bba1e4

File tree

6 files changed

+23
-44
lines changed

6 files changed

+23
-44
lines changed

.gitlab-ci.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,9 @@ build:build-generate:
151151
- ./tmp/build-pipelines.yml
152152
rules:
153153
# Runs on staging commits and ignores version commits
154-
- if: $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
155-
# Manually run on commits other than master and staging and ignore version commits
156-
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH !~ /^(?:master|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
157-
when: manual
154+
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
155+
# Runs on tag pipeline where the tag is a prerelease or release version
156+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
158157

159158
build:platforms:
160159
stage: build
@@ -169,10 +168,9 @@ build:platforms:
169168
strategy: depend
170169
rules:
171170
# Runs on staging commits and ignores version commits
172-
- if: $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
173-
# Manually run on commits other than master and staging and ignore version commits
174-
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH !~ /^(?:master|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
175-
when: manual
171+
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
172+
# Runs on tag pipeline where the tag is a prerelease or release version
173+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
176174

177175
build:prerelease:
178176
stage: build

jest.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ module.exports = {
3838
},
3939
reporters: [
4040
'default',
41-
['jest-junit', { outputDirectory: '<rootDir>/tmp/junit' }],
41+
['jest-junit', {
42+
outputDirectory: '<rootDir>/tmp/junit',
43+
classNameTemplate: '{classname}',
44+
titleTemplate: '{title}',
45+
addFileAttribute: 'true',
46+
}],
4247
],
4348
collectCoverageFrom: ['src/**/*.{ts,tsx,js,jsx}', '!src/**/*.d.ts'],
4449
coverageReporters: ['text', 'cobertura'],

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"eslint-plugin-import": "^2.26.0",
5151
"eslint-plugin-prettier": "^4.0.0",
5252
"jest": "^28.1.1",
53-
"jest-junit": "^13.2.0",
53+
"jest-junit": "^14.0.0",
5454
"jest-mock-process": "^1.4.0",
5555
"pkg": "5.6.0",
5656
"prettier": "^2.6.2",

scripts/build-pipelines.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ build:linux:
7373
coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+)/'
7474
rules:
7575
# Runs on staging commits and ignores version commits
76-
- if: $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
76+
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
7777
# Runs on tag pipeline where the tag is a prerelease or release version
7878
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
7979
EOF
@@ -103,7 +103,7 @@ build:windows:
103103
- ./tmp/junit/junit.xml
104104
rules:
105105
# Runs on staging commits and ignores version commits
106-
- if: $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
106+
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
107107
# Runs on tag pipeline where the tag is a prerelease or release version
108108
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
109109
EOF
@@ -138,7 +138,7 @@ build:macos:
138138
- ./tmp/junit/junit.xml
139139
rules:
140140
# Runs on staging commits and ignores version commits
141-
- if: $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
141+
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
142142
# Runs on tag pipeline where the tag is a prerelease or release version
143143
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
144144
EOF

tests/testSequencer.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)