Skip to content

Commit

Permalink
feat(reporters): add static filepath property to all reporters (#11015)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Jan 19, 2021
1 parent f0dc993 commit d00695d
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -13,10 +13,11 @@
- `[jest-haste-map]` Handle injected scm clocks ([#10966](https://github.com/facebook/jest/pull/10966))
- `[jest-repl, jest-runner]` [**BREAKING**] Run transforms over environment ([#8751](https://github.com/facebook/jest/pull/8751))
- `[jest-runner]` [**BREAKING**] set exit code to 1 if test logs after teardown ([#10728](https://github.com/facebook/jest/pull/10728))
- `[jest-snapshot]` [**BREAKING**] Make prettier optional for inline snapshots - fall back to string replacement ([#7792](https://github.com/facebook/jest/pull/7792))
- `[jest-runner]` [**BREAKING**] Run transforms over `runnner` ([#8823](https://github.com/facebook/jest/pull/8823))
- `[jest-runner]` [**BREAKING**] Run transforms over `testRunnner` ([#8823](https://github.com/facebook/jest/pull/8823))
- `[jest-runtime, jest-transform]` share `cacheFS` between runtime and transformer ([#10901](https://github.com/facebook/jest/pull/10901))
- `[jest-reporters]` Add static filepath property to all reporters ([#11015](https://github.com/facebook/jest/pull/11015))
- `[jest-snapshot]` [**BREAKING**] Make prettier optional for inline snapshots - fall back to string replacement ([#7792](https://github.com/facebook/jest/pull/7792))
- `[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))
- `[jest-worker]` Add support for custom task queues and adds a `PriorityQueue` implementation. ([#10921](https://github.com/facebook/jest/pull/10921))
- `[jest-worker]` Add in-order scheduling policy to jest worker ([10902](https://github.com/facebook/jest/pull/10902))
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-core/src/TestScheduler.ts
Expand Up @@ -458,11 +458,11 @@ const createAggregatedResults = (numTotalTestSuites: number) => {
};

const getEstimatedTime = (timings: Array<number>, workers: number) => {
if (!timings.length) {
if (timings.length === 0) {
return 0;
}

const max = Math.max.apply(null, timings);
const max = Math.max(...timings);
return timings.length <= workers
? max
: Math.max(timings.reduce((sum, time) => sum + time) / workers, max);
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-reporters/src/CoverageReporter.ts
Expand Up @@ -50,6 +50,8 @@ export default class CoverageReporter extends BaseReporter {
private _options: CoverageReporterOptions;
private _v8CoverageResults: Array<V8CoverageResult>;

static readonly filename = __filename;

constructor(
globalConfig: Config.GlobalConfig,
options?: CoverageReporterOptions,
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-reporters/src/DefaultReporter.ts
Expand Up @@ -33,6 +33,8 @@ export default class DefaultReporter extends BaseReporter {
private _status: Status;
private _bufferedOutput: Set<FlushBufferedOutput>;

static readonly filename = __filename;

constructor(globalConfig: Config.GlobalConfig) {
super();
this._globalConfig = globalConfig;
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-reporters/src/NotifyReporter.ts
Expand Up @@ -24,6 +24,8 @@ export default class NotifyReporter extends BaseReporter {
private _globalConfig: Config.GlobalConfig;
private _context: TestSchedulerContext;

static readonly filename = __filename;

constructor(
globalConfig: Config.GlobalConfig,
startRun: (globalConfig: Config.GlobalConfig) => unknown,
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-reporters/src/SummaryReporter.ts
Expand Up @@ -54,6 +54,8 @@ export default class SummaryReporter extends BaseReporter {
private _estimatedTime: number;
private _globalConfig: Config.GlobalConfig;

static readonly filename = __filename;

constructor(globalConfig: Config.GlobalConfig) {
super();
this._globalConfig = globalConfig;
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-reporters/src/VerboseReporter.ts
Expand Up @@ -22,6 +22,8 @@ const {ICONS} = specialChars;
export default class VerboseReporter extends DefaultReporter {
protected _globalConfig: Config.GlobalConfig;

static readonly filename = __filename;

constructor(globalConfig: Config.GlobalConfig) {
super(globalConfig);
this._globalConfig = globalConfig;
Expand Down

0 comments on commit d00695d

Please sign in to comment.