Skip to content

Commit d00695d

Browse files
authored
feat(reporters): add static filepath property to all reporters (#11015)
1 parent f0dc993 commit d00695d

File tree

7 files changed

+14
-3
lines changed

7 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
- `[jest-haste-map]` Handle injected scm clocks ([#10966](https://github.com/facebook/jest/pull/10966))
1414
- `[jest-repl, jest-runner]` [**BREAKING**] Run transforms over environment ([#8751](https://github.com/facebook/jest/pull/8751))
1515
- `[jest-runner]` [**BREAKING**] set exit code to 1 if test logs after teardown ([#10728](https://github.com/facebook/jest/pull/10728))
16-
- `[jest-snapshot]` [**BREAKING**] Make prettier optional for inline snapshots - fall back to string replacement ([#7792](https://github.com/facebook/jest/pull/7792))
1716
- `[jest-runner]` [**BREAKING**] Run transforms over `runnner` ([#8823](https://github.com/facebook/jest/pull/8823))
1817
- `[jest-runner]` [**BREAKING**] Run transforms over `testRunnner` ([#8823](https://github.com/facebook/jest/pull/8823))
1918
- `[jest-runtime, jest-transform]` share `cacheFS` between runtime and transformer ([#10901](https://github.com/facebook/jest/pull/10901))
19+
- `[jest-reporters]` Add static filepath property to all reporters ([#11015](https://github.com/facebook/jest/pull/11015))
20+
- `[jest-snapshot]` [**BREAKING**] Make prettier optional for inline snapshots - fall back to string replacement ([#7792](https://github.com/facebook/jest/pull/7792))
2021
- `[jest-transform]` Pass config options defined in Jest's config to transformer's `process` and `getCacheKey` functions ([#10926](https://github.com/facebook/jest/pull/10926))
2122
- `[jest-worker]` Add support for custom task queues and adds a `PriorityQueue` implementation. ([#10921](https://github.com/facebook/jest/pull/10921))
2223
- `[jest-worker]` Add in-order scheduling policy to jest worker ([10902](https://github.com/facebook/jest/pull/10902))

packages/jest-core/src/TestScheduler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,11 @@ const createAggregatedResults = (numTotalTestSuites: number) => {
458458
};
459459

460460
const getEstimatedTime = (timings: Array<number>, workers: number) => {
461-
if (!timings.length) {
461+
if (timings.length === 0) {
462462
return 0;
463463
}
464464

465-
const max = Math.max.apply(null, timings);
465+
const max = Math.max(...timings);
466466
return timings.length <= workers
467467
? max
468468
: Math.max(timings.reduce((sum, time) => sum + time) / workers, max);

packages/jest-reporters/src/CoverageReporter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export default class CoverageReporter extends BaseReporter {
5050
private _options: CoverageReporterOptions;
5151
private _v8CoverageResults: Array<V8CoverageResult>;
5252

53+
static readonly filename = __filename;
54+
5355
constructor(
5456
globalConfig: Config.GlobalConfig,
5557
options?: CoverageReporterOptions,

packages/jest-reporters/src/DefaultReporter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export default class DefaultReporter extends BaseReporter {
3333
private _status: Status;
3434
private _bufferedOutput: Set<FlushBufferedOutput>;
3535

36+
static readonly filename = __filename;
37+
3638
constructor(globalConfig: Config.GlobalConfig) {
3739
super();
3840
this._globalConfig = globalConfig;

packages/jest-reporters/src/NotifyReporter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export default class NotifyReporter extends BaseReporter {
2424
private _globalConfig: Config.GlobalConfig;
2525
private _context: TestSchedulerContext;
2626

27+
static readonly filename = __filename;
28+
2729
constructor(
2830
globalConfig: Config.GlobalConfig,
2931
startRun: (globalConfig: Config.GlobalConfig) => unknown,

packages/jest-reporters/src/SummaryReporter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export default class SummaryReporter extends BaseReporter {
5454
private _estimatedTime: number;
5555
private _globalConfig: Config.GlobalConfig;
5656

57+
static readonly filename = __filename;
58+
5759
constructor(globalConfig: Config.GlobalConfig) {
5860
super();
5961
this._globalConfig = globalConfig;

packages/jest-reporters/src/VerboseReporter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const {ICONS} = specialChars;
2222
export default class VerboseReporter extends DefaultReporter {
2323
protected _globalConfig: Config.GlobalConfig;
2424

25+
static readonly filename = __filename;
26+
2527
constructor(globalConfig: Config.GlobalConfig) {
2628
super(globalConfig);
2729
this._globalConfig = globalConfig;

0 commit comments

Comments
 (0)