Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66609d2

Browse files
committed
Add new default reporter for github actions
1 parent 6e5b1d6 commit 66609d2

File tree

3 files changed

+73
-21
lines changed

3 files changed

+73
-21
lines changed

packages/jest-core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@jest/test-result": "workspace:^",
1818
"@jest/transform": "workspace:^",
1919
"@jest/types": "workspace:^",
20+
"@matteoh2o1999/github-actions-jest-reporter": "^1.0.2",
2021
"@types/node": "*",
2122
"ansi-escapes": "^4.2.1",
2223
"chalk": "^4.0.0",

packages/jest-core/src/TestScheduler.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
import GHActionsReporter from '@matteoh2o1999/github-actions-jest-reporter';
89
import chalk = require('chalk');
910
import {GITHUB_ACTIONS} from 'ci-info';
1011
import exit = require('exit');
@@ -341,10 +342,20 @@ class TestScheduler {
341342
for (const [reporter, options] of reporters) {
342343
switch (reporter) {
343344
case 'default':
344-
summary = true;
345-
verbose
346-
? this.addReporter(new VerboseReporter(this._globalConfig))
347-
: this.addReporter(new DefaultReporter(this._globalConfig));
345+
if (verbose) {
346+
this.addReporter(new VerboseReporter(this._globalConfig));
347+
summary = true;
348+
} else {
349+
if (GITHUB_ACTIONS) {
350+
this.addReporter(
351+
new GHActionsReporter(this._globalConfig, {}, {}),
352+
);
353+
summary = false;
354+
} else {
355+
this.addReporter(new DefaultReporter(this._globalConfig));
356+
summary = true;
357+
}
358+
}
348359
break;
349360
case 'github-actions':
350361
GITHUB_ACTIONS && this.addReporter(new GitHubActionsReporter());

yarn.lock

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ __metadata:
55
version: 6
66
cacheKey: 8
77

8+
"@actions/core@npm:^1.10.0":
9+
version: 1.10.0
10+
resolution: "@actions/core@npm:1.10.0"
11+
dependencies:
12+
"@actions/http-client": ^2.0.1
13+
uuid: ^8.3.2
14+
checksum: 0a75621e007ab20d887434cdd165f0b9036f14c22252a2faed33543d8b9d04ec95d823e69ca636a25245574e4585d73e1e9e47a845339553c664f9f2c9614669
15+
languageName: node
16+
linkType: hard
17+
18+
"@actions/http-client@npm:^2.0.1":
19+
version: 2.0.1
20+
resolution: "@actions/http-client@npm:2.0.1"
21+
dependencies:
22+
tunnel: ^0.0.6
23+
checksum: 799ec3df91e28a9da91ce6592e94f8b8923ccf6cc21a2f72c7429be5af5273f1625335411adc2a1bb222d56c852d5767214dfa6fa32a6da7e81dba8290e08f17
24+
languageName: node
25+
linkType: hard
26+
827
"@algolia/autocomplete-core@npm:1.7.2":
928
version: 1.7.2
1029
resolution: "@algolia/autocomplete-core@npm:1.7.2"
@@ -2668,6 +2687,7 @@ __metadata:
26682687
"@jest/test-utils": "workspace:^"
26692688
"@jest/transform": "workspace:^"
26702689
"@jest/types": "workspace:^"
2690+
"@matteoh2o1999/github-actions-jest-reporter": ^1.0.2
26712691
"@types/exit": ^0.1.30
26722692
"@types/graceful-fs": ^4.1.3
26732693
"@types/micromatch": ^4.0.1
@@ -2867,7 +2887,7 @@ __metadata:
28672887
languageName: unknown
28682888
linkType: soft
28692889

2870-
"@jest/reporters@workspace:^, @jest/reporters@workspace:packages/jest-reporters":
2890+
"@jest/reporters@^29.3.1, @jest/reporters@workspace:^, @jest/reporters@workspace:packages/jest-reporters":
28712891
version: 0.0.0-use.local
28722892
resolution: "@jest/reporters@workspace:packages/jest-reporters"
28732893
dependencies:
@@ -2947,7 +2967,7 @@ __metadata:
29472967
languageName: unknown
29482968
linkType: soft
29492969

2950-
"@jest/test-result@workspace:^, @jest/test-result@workspace:packages/jest-test-result":
2970+
"@jest/test-result@^29.3.1, @jest/test-result@workspace:^, @jest/test-result@workspace:packages/jest-test-result":
29512971
version: 0.0.0-use.local
29522972
resolution: "@jest/test-result@workspace:packages/jest-test-result"
29532973
dependencies:
@@ -3014,6 +3034,21 @@ __metadata:
30143034
languageName: unknown
30153035
linkType: soft
30163036

3037+
"@jest/types@^29.3.1, @jest/types@workspace:^, @jest/types@workspace:packages/jest-types":
3038+
version: 0.0.0-use.local
3039+
resolution: "@jest/types@workspace:packages/jest-types"
3040+
dependencies:
3041+
"@jest/schemas": "workspace:^"
3042+
"@tsd/typescript": ^4.9.0
3043+
"@types/istanbul-lib-coverage": ^2.0.0
3044+
"@types/istanbul-reports": ^3.0.0
3045+
"@types/node": "*"
3046+
"@types/yargs": ^17.0.8
3047+
chalk: ^4.0.0
3048+
tsd-lite: ^0.6.0
3049+
languageName: unknown
3050+
linkType: soft
3051+
30173052
"@jest/types@npm:^26.6.2":
30183053
version: 26.6.2
30193054
resolution: "@jest/types@npm:26.6.2"
@@ -3040,21 +3075,6 @@ __metadata:
30403075
languageName: node
30413076
linkType: hard
30423077

3043-
"@jest/types@workspace:^, @jest/types@workspace:packages/jest-types":
3044-
version: 0.0.0-use.local
3045-
resolution: "@jest/types@workspace:packages/jest-types"
3046-
dependencies:
3047-
"@jest/schemas": "workspace:^"
3048-
"@tsd/typescript": ^4.9.0
3049-
"@types/istanbul-lib-coverage": ^2.0.0
3050-
"@types/istanbul-reports": ^3.0.0
3051-
"@types/node": "*"
3052-
"@types/yargs": ^17.0.8
3053-
chalk: ^4.0.0
3054-
tsd-lite: ^0.6.0
3055-
languageName: unknown
3056-
linkType: soft
3057-
30583078
"@jridgewell/gen-mapping@npm:^0.1.0":
30593079
version: 0.1.1
30603080
resolution: "@jridgewell/gen-mapping@npm:0.1.1"
@@ -3314,6 +3334,19 @@ __metadata:
33143334
languageName: node
33153335
linkType: hard
33163336

3337+
"@matteoh2o1999/github-actions-jest-reporter@npm:^1.0.2":
3338+
version: 1.0.2
3339+
resolution: "@matteoh2o1999/github-actions-jest-reporter@npm:1.0.2"
3340+
dependencies:
3341+
"@actions/core": ^1.10.0
3342+
"@jest/reporters": ^29.3.1
3343+
"@jest/test-result": ^29.3.1
3344+
"@jest/types": ^29.3.1
3345+
chalk: ^4.0.0
3346+
checksum: 32b2d59cc2d24028267eb90e468aa931d69679cf754063375b418f1570dd419510fff3e2f198ec813f01914e458a4db490c647313b3525816e8f02d4be241743
3347+
languageName: node
3348+
linkType: hard
3349+
33173350
"@mdx-js/mdx@npm:^1.6.22":
33183351
version: 1.6.22
33193352
resolution: "@mdx-js/mdx@npm:1.6.22"
@@ -19938,6 +19971,13 @@ __metadata:
1993819971
languageName: node
1993919972
linkType: hard
1994019973

19974+
"tunnel@npm:^0.0.6":
19975+
version: 0.0.6
19976+
resolution: "tunnel@npm:0.0.6"
19977+
checksum: c362948df9ad34b649b5585e54ce2838fa583aa3037091aaed66793c65b423a264e5229f0d7e9a95513a795ac2bd4cb72cda7e89a74313f182c1e9ae0b0994fa
19978+
languageName: node
19979+
linkType: hard
19980+
1994119981
"type-check@npm:^0.4.0, type-check@npm:~0.4.0":
1994219982
version: 0.4.0
1994319983
resolution: "type-check@npm:0.4.0"

0 commit comments

Comments
 (0)