Skip to content

Commit 49842f2

Browse files
committed
use helper in all tests
1 parent a386875 commit 49842f2

File tree

3 files changed

+18
-25
lines changed

3 files changed

+18
-25
lines changed

packages/jest-reporters/src/DefaultReporter.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,7 @@ export default class DefaultReporter extends BaseReporter {
206206
const testRetryReasons = testResult.retryReasons;
207207
if (testRetryReasons && testRetryReasons.length > 0) {
208208
this.log(
209-
`${chalk.reset.inverse.bold.yellow(
210-
' LOGGING RETRY ERRORS ',
211-
)} ${chalk.bold(testResult.fullName)}`,
209+
`${chalk.reset.inverse.bold.yellow(' LOGGING RETRY ERRORS ')} ${chalk.bold(testResult.fullName)}`,
212210
);
213211
for (const [index, retryReasons] of testRetryReasons.entries()) {
214212
let {message, stack} = separateMessageFromStack(retryReasons);
@@ -231,11 +229,7 @@ export default class DefaultReporter extends BaseReporter {
231229
this.log(getResultHeader(result, this._globalConfig, config));
232230
if (result.console) {
233231
this.log(
234-
` ${TITLE_BULLET}Console\n\n${getConsoleOutput(
235-
result.console,
236-
config,
237-
this._globalConfig,
238-
)}`,
232+
` ${TITLE_BULLET}Console\n\n${getConsoleOutput(result.console, config, this._globalConfig)}`,
239233
);
240234
}
241235
}

packages/jest-reporters/src/GitHubActionsReporter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ export default class GitHubActionsReporter extends BaseReporter {
317317
private printResultTree(
318318
resultTree: ResultTree,
319319
config: Config.ProjectConfig,
320-
consoleLog?: ConsoleBuffer,
320+
consoleLog: ConsoleBuffer | undefined,
321321
): void {
322322
let perfMs;
323323
if (resultTree.performanceInfo.slow) {

packages/jest-reporters/src/__tests__/GitHubActionsReporter.test.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import type {
1414
TestResult,
1515
} from '@jest/test-result';
1616
import {makeGlobalConfig, normalizeIcons} from '@jest/test-utils';
17-
import type {Config} from '@jest/types';
1817
import BaseGitHubActionsReporter from '../GitHubActionsReporter';
1918

2019
afterEach(() => {
@@ -32,7 +31,7 @@ const mockedStderrWrite = jest
3231
.mockImplementation(() => true);
3332

3433
describe('annotations', () => {
35-
const reporter = new GitHubActionsReporter({} as Config.GlobalConfig);
34+
const reporter = new GitHubActionsReporter(makeGlobalConfig());
3635

3736
const testMeta = {
3837
context: {config: {rootDir: '/user/project'}},
@@ -155,7 +154,7 @@ describe('annotations', () => {
155154

156155
describe('logs', () => {
157156
test('can be instantiated', () => {
158-
const gha = new GitHubActionsReporter({} as Config.GlobalConfig);
157+
const gha = new GitHubActionsReporter(makeGlobalConfig());
159158
expect(gha).toBeTruthy();
160159
expect(gha).toBeInstanceOf(GitHubActionsReporter);
161160
});
@@ -194,7 +193,7 @@ describe('logs', () => {
194193
start: 10,
195194
},
196195
};
197-
const gha = new GitHubActionsReporter({} as Config.GlobalConfig, {
196+
const gha = new GitHubActionsReporter(makeGlobalConfig(), {
198197
silent: false,
199198
});
200199

@@ -237,7 +236,7 @@ describe('logs', () => {
237236
start: 10,
238237
},
239238
};
240-
const gha = new GitHubActionsReporter({} as Config.GlobalConfig, {
239+
const gha = new GitHubActionsReporter(makeGlobalConfig(), {
241240
silent: false,
242241
});
243242

@@ -286,7 +285,7 @@ describe('logs', () => {
286285
start: 10,
287286
},
288287
};
289-
const gha = new GitHubActionsReporter({} as Config.GlobalConfig, {
288+
const gha = new GitHubActionsReporter(makeGlobalConfig(), {
290289
silent: false,
291290
});
292291

@@ -335,7 +334,7 @@ describe('logs', () => {
335334
start: 10,
336335
},
337336
};
338-
const gha = new GitHubActionsReporter({} as Config.GlobalConfig, {
337+
const gha = new GitHubActionsReporter(makeGlobalConfig(), {
339338
silent: false,
340339
});
341340

@@ -396,7 +395,7 @@ describe('logs', () => {
396395
start: 10,
397396
},
398397
};
399-
const gha = new GitHubActionsReporter({} as Config.GlobalConfig, {
398+
const gha = new GitHubActionsReporter(makeGlobalConfig(), {
400399
silent: false,
401400
});
402401

@@ -427,7 +426,7 @@ describe('logs', () => {
427426
start: 10,
428427
},
429428
};
430-
const gha = new GitHubActionsReporter({} as Config.GlobalConfig, {
429+
const gha = new GitHubActionsReporter(makeGlobalConfig(), {
431430
silent: false,
432431
});
433432

@@ -455,7 +454,7 @@ describe('logs', () => {
455454
start: 10,
456455
},
457456
};
458-
const gha = new GitHubActionsReporter({} as Config.GlobalConfig, {
457+
const gha = new GitHubActionsReporter(makeGlobalConfig(), {
459458
silent: false,
460459
});
461460

@@ -489,7 +488,7 @@ describe('logs', () => {
489488
start: 10,
490489
},
491490
};
492-
const gha = new GitHubActionsReporter({} as Config.GlobalConfig, {
491+
const gha = new GitHubActionsReporter(makeGlobalConfig(), {
493492
silent: false,
494493
});
495494

@@ -523,7 +522,7 @@ describe('logs', () => {
523522
start: 10,
524523
},
525524
};
526-
const gha = new GitHubActionsReporter({} as Config.GlobalConfig, {
525+
const gha = new GitHubActionsReporter(makeGlobalConfig(), {
527526
silent: false,
528527
});
529528

@@ -557,7 +556,7 @@ describe('logs', () => {
557556
start: 10,
558557
},
559558
};
560-
const gha = new GitHubActionsReporter({} as Config.GlobalConfig, {
559+
const gha = new GitHubActionsReporter(makeGlobalConfig(), {
561560
silent: false,
562561
});
563562

@@ -591,7 +590,7 @@ describe('logs', () => {
591590
start: 10,
592591
},
593592
};
594-
const gha = new GitHubActionsReporter({} as Config.GlobalConfig, {
593+
const gha = new GitHubActionsReporter(makeGlobalConfig(), {
595594
silent: false,
596595
});
597596

@@ -630,7 +629,7 @@ describe('logs', () => {
630629
numPassedTestSuites: 1,
631630
numTotalTestSuites: 3,
632631
};
633-
const gha = new GitHubActionsReporter({} as Config.GlobalConfig, {
632+
const gha = new GitHubActionsReporter(makeGlobalConfig(), {
634633
silent: false,
635634
});
636635
gha.generateAnnotations = jest.fn();
@@ -674,7 +673,7 @@ describe('logs', () => {
674673
numTotalTestSuites: 3,
675674
testResults: [mockTestResult],
676675
};
677-
const gha = new GitHubActionsReporter({} as Config.GlobalConfig, {
676+
const gha = new GitHubActionsReporter(makeGlobalConfig(), {
678677
silent: false,
679678
});
680679
gha.generateAnnotations = jest.fn();

0 commit comments

Comments
 (0)