Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(reporters): add static filepath property to all reporters #11015

Merged
merged 2 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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