Skip to content

Commit

Permalink
Add new default reporter for github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoH2O1999 committed Nov 18, 2022
1 parent 6e5b1d6 commit 66609d2
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 21 deletions.
1 change: 1 addition & 0 deletions packages/jest-core/package.json
Expand Up @@ -17,6 +17,7 @@
"@jest/test-result": "workspace:^",
"@jest/transform": "workspace:^",
"@jest/types": "workspace:^",
"@matteoh2o1999/github-actions-jest-reporter": "^1.0.2",
"@types/node": "*",
"ansi-escapes": "^4.2.1",
"chalk": "^4.0.0",
Expand Down
19 changes: 15 additions & 4 deletions packages/jest-core/src/TestScheduler.ts
Expand Up @@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import GHActionsReporter from '@matteoh2o1999/github-actions-jest-reporter';
import chalk = require('chalk');
import {GITHUB_ACTIONS} from 'ci-info';
import exit = require('exit');
Expand Down Expand Up @@ -341,10 +342,20 @@ class TestScheduler {
for (const [reporter, options] of reporters) {
switch (reporter) {
case 'default':
summary = true;
verbose
? this.addReporter(new VerboseReporter(this._globalConfig))
: this.addReporter(new DefaultReporter(this._globalConfig));
if (verbose) {
this.addReporter(new VerboseReporter(this._globalConfig));
summary = true;
} else {
if (GITHUB_ACTIONS) {
this.addReporter(
new GHActionsReporter(this._globalConfig, {}, {}),
);
summary = false;
} else {
this.addReporter(new DefaultReporter(this._globalConfig));
summary = true;
}
}
break;
case 'github-actions':
GITHUB_ACTIONS && this.addReporter(new GitHubActionsReporter());
Expand Down
74 changes: 57 additions & 17 deletions yarn.lock
Expand Up @@ -5,6 +5,25 @@ __metadata:
version: 6
cacheKey: 8

"@actions/core@npm:^1.10.0":
version: 1.10.0
resolution: "@actions/core@npm:1.10.0"
dependencies:
"@actions/http-client": ^2.0.1
uuid: ^8.3.2
checksum: 0a75621e007ab20d887434cdd165f0b9036f14c22252a2faed33543d8b9d04ec95d823e69ca636a25245574e4585d73e1e9e47a845339553c664f9f2c9614669
languageName: node
linkType: hard

"@actions/http-client@npm:^2.0.1":
version: 2.0.1
resolution: "@actions/http-client@npm:2.0.1"
dependencies:
tunnel: ^0.0.6
checksum: 799ec3df91e28a9da91ce6592e94f8b8923ccf6cc21a2f72c7429be5af5273f1625335411adc2a1bb222d56c852d5767214dfa6fa32a6da7e81dba8290e08f17
languageName: node
linkType: hard

"@algolia/autocomplete-core@npm:1.7.2":
version: 1.7.2
resolution: "@algolia/autocomplete-core@npm:1.7.2"
Expand Down Expand Up @@ -2668,6 +2687,7 @@ __metadata:
"@jest/test-utils": "workspace:^"
"@jest/transform": "workspace:^"
"@jest/types": "workspace:^"
"@matteoh2o1999/github-actions-jest-reporter": ^1.0.2
"@types/exit": ^0.1.30
"@types/graceful-fs": ^4.1.3
"@types/micromatch": ^4.0.1
Expand Down Expand Up @@ -2867,7 +2887,7 @@ __metadata:
languageName: unknown
linkType: soft

"@jest/reporters@workspace:^, @jest/reporters@workspace:packages/jest-reporters":
"@jest/reporters@^29.3.1, @jest/reporters@workspace:^, @jest/reporters@workspace:packages/jest-reporters":
version: 0.0.0-use.local
resolution: "@jest/reporters@workspace:packages/jest-reporters"
dependencies:
Expand Down Expand Up @@ -2947,7 +2967,7 @@ __metadata:
languageName: unknown
linkType: soft

"@jest/test-result@workspace:^, @jest/test-result@workspace:packages/jest-test-result":
"@jest/test-result@^29.3.1, @jest/test-result@workspace:^, @jest/test-result@workspace:packages/jest-test-result":
version: 0.0.0-use.local
resolution: "@jest/test-result@workspace:packages/jest-test-result"
dependencies:
Expand Down Expand Up @@ -3014,6 +3034,21 @@ __metadata:
languageName: unknown
linkType: soft

"@jest/types@^29.3.1, @jest/types@workspace:^, @jest/types@workspace:packages/jest-types":
version: 0.0.0-use.local
resolution: "@jest/types@workspace:packages/jest-types"
dependencies:
"@jest/schemas": "workspace:^"
"@tsd/typescript": ^4.9.0
"@types/istanbul-lib-coverage": ^2.0.0
"@types/istanbul-reports": ^3.0.0
"@types/node": "*"
"@types/yargs": ^17.0.8
chalk: ^4.0.0
tsd-lite: ^0.6.0
languageName: unknown
linkType: soft

"@jest/types@npm:^26.6.2":
version: 26.6.2
resolution: "@jest/types@npm:26.6.2"
Expand All @@ -3040,21 +3075,6 @@ __metadata:
languageName: node
linkType: hard

"@jest/types@workspace:^, @jest/types@workspace:packages/jest-types":
version: 0.0.0-use.local
resolution: "@jest/types@workspace:packages/jest-types"
dependencies:
"@jest/schemas": "workspace:^"
"@tsd/typescript": ^4.9.0
"@types/istanbul-lib-coverage": ^2.0.0
"@types/istanbul-reports": ^3.0.0
"@types/node": "*"
"@types/yargs": ^17.0.8
chalk: ^4.0.0
tsd-lite: ^0.6.0
languageName: unknown
linkType: soft

"@jridgewell/gen-mapping@npm:^0.1.0":
version: 0.1.1
resolution: "@jridgewell/gen-mapping@npm:0.1.1"
Expand Down Expand Up @@ -3314,6 +3334,19 @@ __metadata:
languageName: node
linkType: hard

"@matteoh2o1999/github-actions-jest-reporter@npm:^1.0.2":
version: 1.0.2
resolution: "@matteoh2o1999/github-actions-jest-reporter@npm:1.0.2"
dependencies:
"@actions/core": ^1.10.0
"@jest/reporters": ^29.3.1
"@jest/test-result": ^29.3.1
"@jest/types": ^29.3.1
chalk: ^4.0.0
checksum: 32b2d59cc2d24028267eb90e468aa931d69679cf754063375b418f1570dd419510fff3e2f198ec813f01914e458a4db490c647313b3525816e8f02d4be241743
languageName: node
linkType: hard

"@mdx-js/mdx@npm:^1.6.22":
version: 1.6.22
resolution: "@mdx-js/mdx@npm:1.6.22"
Expand Down Expand Up @@ -19938,6 +19971,13 @@ __metadata:
languageName: node
linkType: hard

"tunnel@npm:^0.0.6":
version: 0.0.6
resolution: "tunnel@npm:0.0.6"
checksum: c362948df9ad34b649b5585e54ce2838fa583aa3037091aaed66793c65b423a264e5229f0d7e9a95513a795ac2bd4cb72cda7e89a74313f182c1e9ae0b0994fa
languageName: node
linkType: hard

"type-check@npm:^0.4.0, type-check@npm:~0.4.0":
version: 0.4.0
resolution: "type-check@npm:0.4.0"
Expand Down

0 comments on commit 66609d2

Please sign in to comment.