Skip to content

Commit 79e189f

Browse files
richvdhtexuf
authored andcommitted
Improve output in github actions for jest tests (matrix-org#3269)
1 parent ba156e6 commit 79e189f

File tree

4 files changed

+131
-27
lines changed

4 files changed

+131
-27
lines changed

.github/workflows/tests.yml

-7
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,11 @@ jobs:
4040
id: cpu-cores
4141
uses: SimenB/github-actions-cpu-cores@410541432439795d30db6501fb1d8178eb41e502 # v1
4242

43-
- name: Load metrics reporter
44-
id: metrics
45-
if: github.ref == 'refs/heads/develop'
46-
run: |
47-
echo "extra-reporter='--reporters=<rootDir>/spec/slowReporter.js'" >> $GITHUB_OUTPUT
48-
4943
- name: Run tests
5044
run: |
5145
yarn test \
5246
--coverage=${{ env.ENABLE_COVERAGE }} \
5347
--ci \
54-
--reporters github-actions ${{ steps.metrics.outputs.extra-reporter }} \
5548
--max-workers ${{ steps.cpu-cores.outputs.count }} \
5649
./spec/${{ matrix.specs }}
5750
env:

jest.config.ts

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* Copyright 2023 The Matrix.org Foundation C.I.C.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
*/
15+
16+
import type { Config } from "jest";
17+
import { env } from "process";
18+
19+
const config: Config = {
20+
testEnvironment: "node",
21+
testMatch: ["<rootDir>/spec/**/*.spec.{js,ts}"],
22+
setupFilesAfterEnv: ["<rootDir>/spec/setupTests.ts"],
23+
collectCoverageFrom: ["<rootDir>/src/**/*.{js,ts}"],
24+
coverageReporters: ["text-summary", "lcov"],
25+
testResultsProcessor: "@casualbot/jest-sonar-reporter",
26+
};
27+
28+
// if we're running under GHA, enable the GHA reporter
29+
if (env["GITHUB_ACTIONS"] !== undefined) {
30+
const reporters: Config["reporters"] = [["github-actions", { silent: false }], "summary"];
31+
32+
// if we're running against the develop branch, also enable the slow test reporter
33+
if (env["GITHUB_REF"] == "refs/heads/develop") {
34+
reporters.push("<rootDir>/spec/slowReporter.js");
35+
}
36+
config.reporters = reporters;
37+
}
38+
39+
export default config;

package.json

+1-17
Original file line numberDiff line numberDiff line change
@@ -122,28 +122,12 @@
122122
"prettier": "2.8.7",
123123
"rimraf": "^4.0.0",
124124
"terser": "^5.5.1",
125+
"ts-node": "^10.9.1",
125126
"tsify": "^5.0.2",
126127
"typedoc": "^0.23.20",
127128
"typedoc-plugin-missing-exports": "^1.0.0",
128129
"typescript": "^5.0.0"
129130
},
130-
"jest": {
131-
"testEnvironment": "node",
132-
"testMatch": [
133-
"<rootDir>/spec/**/*.spec.{js,ts}"
134-
],
135-
"setupFilesAfterEnv": [
136-
"<rootDir>/spec/setupTests.ts"
137-
],
138-
"collectCoverageFrom": [
139-
"<rootDir>/src/**/*.{js,ts}"
140-
],
141-
"coverageReporters": [
142-
"text-summary",
143-
"lcov"
144-
],
145-
"testResultsProcessor": "@casualbot/jest-sonar-reporter"
146-
},
147131
"@casualbot/jest-sonar-reporter": {
148132
"outputDirectory": "coverage",
149133
"outputName": "jest-sonar-report.xml",

yarn.lock

+91-3
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,13 @@
10531053
uuid "8.3.2"
10541054
xml "1.0.1"
10551055

1056+
"@cspotcode/source-map-support@^0.8.0":
1057+
version "0.8.1"
1058+
resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1"
1059+
integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==
1060+
dependencies:
1061+
"@jridgewell/trace-mapping" "0.3.9"
1062+
10561063
"@es-joy/jsdoccomment@~0.37.0":
10571064
version "0.37.0"
10581065
resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.37.0.tgz#aaafb4bb6c88288aa7899aef0f3b1b851c36f908"
@@ -1361,6 +1368,11 @@
13611368
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78"
13621369
integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==
13631370

1371+
"@jridgewell/resolve-uri@^3.0.3":
1372+
version "3.1.1"
1373+
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721"
1374+
integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==
1375+
13641376
"@jridgewell/set-array@^1.0.1":
13651377
version "1.1.2"
13661378
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72"
@@ -1384,6 +1396,14 @@
13841396
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32"
13851397
integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==
13861398

1399+
"@jridgewell/[email protected]":
1400+
version "0.3.9"
1401+
resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9"
1402+
integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==
1403+
dependencies:
1404+
"@jridgewell/resolve-uri" "^3.0.3"
1405+
"@jridgewell/sourcemap-codec" "^1.4.10"
1406+
13871407
"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.15", "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9":
13881408
version "0.3.18"
13891409
resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz#25783b2086daf6ff1dcb53c9249ae480e4dd4cd6"
@@ -1406,7 +1426,6 @@
14061426

14071427
"@matrix-org/olm@https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.14.tgz":
14081428
version "3.2.14"
1409-
uid acd96c00a881d0f462e1f97a56c73742c8dbc984
14101429
resolved "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.14.tgz#acd96c00a881d0f462e1f97a56c73742c8dbc984"
14111430

14121431
"@microsoft/[email protected]":
@@ -1599,6 +1618,26 @@
15991618
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf"
16001619
integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==
16011620

1621+
"@tsconfig/node10@^1.0.7":
1622+
version "1.0.9"
1623+
resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2"
1624+
integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==
1625+
1626+
"@tsconfig/node12@^1.0.7":
1627+
version "1.0.11"
1628+
resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d"
1629+
integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==
1630+
1631+
"@tsconfig/node14@^1.0.0":
1632+
version "1.0.3"
1633+
resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1"
1634+
integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==
1635+
1636+
"@tsconfig/node16@^1.0.2":
1637+
version "1.0.3"
1638+
resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e"
1639+
integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==
1640+
16021641
"@types/babel-types@*", "@types/babel-types@^7.0.0":
16031642
version "7.0.11"
16041643
resolved "https://registry.yarnpkg.com/@types/babel-types/-/babel-types-7.0.11.tgz#263b113fa396fac4373188d73225297fb86f19a9"
@@ -1931,7 +1970,7 @@ acorn-walk@^7.0.0:
19311970
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc"
19321971
integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==
19331972

1934-
acorn-walk@^8.0.2:
1973+
acorn-walk@^8.0.2, acorn-walk@^8.1.1:
19351974
version "8.2.0"
19361975
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1"
19371976
integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==
@@ -1951,7 +1990,7 @@ acorn@^7.0.0:
19511990
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"
19521991
integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==
19531992

1954-
acorn@^8.1.0, acorn@^8.5.0, acorn@^8.8.0, acorn@^8.8.1:
1993+
acorn@^8.1.0, acorn@^8.4.1, acorn@^8.5.0, acorn@^8.8.0, acorn@^8.8.1:
19551994
version "8.8.2"
19561995
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a"
19571996
integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==
@@ -2055,6 +2094,11 @@ anymatch@^3.0.3, anymatch@~3.1.2:
20552094
normalize-path "^3.0.0"
20562095
picomatch "^2.0.4"
20572096

2097+
arg@^4.1.0:
2098+
version "4.1.3"
2099+
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
2100+
integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==
2101+
20582102
argparse@^1.0.7:
20592103
version "1.0.10"
20602104
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
@@ -2923,6 +2967,11 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7:
29232967
safe-buffer "^5.0.1"
29242968
sha.js "^2.4.8"
29252969

2970+
create-require@^1.1.0:
2971+
version "1.1.1"
2972+
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
2973+
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
2974+
29262975
cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
29272976
version "7.0.3"
29282977
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
@@ -3107,6 +3156,11 @@ diff-sequences@^29.4.3:
31073156
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.4.3.tgz#9314bc1fabe09267ffeca9cbafc457d8499a13f2"
31083157
integrity sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==
31093158

3159+
diff@^4.0.1:
3160+
version "4.0.2"
3161+
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
3162+
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
3163+
31103164
diffie-hellman@^5.0.0:
31113165
version "5.0.3"
31123166
resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875"
@@ -5313,6 +5367,11 @@ make-dir@^3.0.0:
53135367
dependencies:
53145368
semver "^6.0.0"
53155369

5370+
make-error@^1.1.1:
5371+
version "1.3.6"
5372+
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
5373+
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==
5374+
53165375
53175376
version "1.0.12"
53185377
resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a"
@@ -7008,6 +7067,25 @@ ts-map@^1.0.3:
70087067
resolved "https://registry.yarnpkg.com/ts-map/-/ts-map-1.0.3.tgz#1c4d218dec813d2103b7e04e4bcf348e1471c1ff"
70097068
integrity sha512-vDWbsl26LIcPGmDpoVzjEP6+hvHZkBkLW7JpvwbCv/5IYPJlsbzCVXY3wsCeAxAUeTclNOUZxnLdGh3VBD/J6w==
70107069

7070+
ts-node@^10.9.1:
7071+
version "10.9.1"
7072+
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b"
7073+
integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==
7074+
dependencies:
7075+
"@cspotcode/source-map-support" "^0.8.0"
7076+
"@tsconfig/node10" "^1.0.7"
7077+
"@tsconfig/node12" "^1.0.7"
7078+
"@tsconfig/node14" "^1.0.0"
7079+
"@tsconfig/node16" "^1.0.2"
7080+
acorn "^8.4.1"
7081+
acorn-walk "^8.1.1"
7082+
arg "^4.1.0"
7083+
create-require "^1.1.0"
7084+
diff "^4.0.1"
7085+
make-error "^1.1.1"
7086+
v8-compile-cache-lib "^3.0.1"
7087+
yn "3.1.1"
7088+
70117089
tsconfig-paths@^3.14.1:
70127090
version "3.14.2"
70137091
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088"
@@ -7322,6 +7400,11 @@ uuid@9:
73227400
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
73237401
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
73247402

7403+
v8-compile-cache-lib@^3.0.1:
7404+
version "3.0.1"
7405+
resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf"
7406+
integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==
7407+
73257408
v8-to-istanbul@^9.0.0, v8-to-istanbul@^9.0.1:
73267409
version "9.1.0"
73277410
resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz#1b83ed4e397f58c85c266a570fc2558b5feb9265"
@@ -7653,6 +7736,11 @@ yargs@~3.10.0:
76537736
decamelize "^1.0.0"
76547737
window-size "0.1.0"
76557738

7739+
7740+
version "3.1.1"
7741+
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
7742+
integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==
7743+
76567744
yocto-queue@^0.1.0:
76577745
version "0.1.0"
76587746
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"

0 commit comments

Comments
 (0)