use separate LastRunReporter instances
This commit is contained in:
parent
b78b88fbac
commit
f62651cfd0
|
|
@ -24,7 +24,6 @@ import { getPackageJsonPath, mergeObjects } from '../util';
|
||||||
import type { Matcher } from '../util';
|
import type { Matcher } from '../util';
|
||||||
import type { ConfigCLIOverrides } from './ipc';
|
import type { ConfigCLIOverrides } from './ipc';
|
||||||
import type { FullConfig, FullProject } from '../../types/testReporter';
|
import type { FullConfig, FullProject } from '../../types/testReporter';
|
||||||
import { LastRunReporter } from '../runner/lastRun';
|
|
||||||
|
|
||||||
export type ConfigLocation = {
|
export type ConfigLocation = {
|
||||||
resolvedConfigFile?: string;
|
resolvedConfigFile?: string;
|
||||||
|
|
@ -59,7 +58,6 @@ export class FullConfigInternal {
|
||||||
defineConfigWasUsed = false;
|
defineConfigWasUsed = false;
|
||||||
shardingMode: ShardingMode;
|
shardingMode: ShardingMode;
|
||||||
lastRunFile: string | undefined;
|
lastRunFile: string | undefined;
|
||||||
readonly lastRunReporter: LastRunReporter;
|
|
||||||
|
|
||||||
constructor(location: ConfigLocation, userConfig: Config, configCLIOverrides: ConfigCLIOverrides) {
|
constructor(location: ConfigLocation, userConfig: Config, configCLIOverrides: ConfigCLIOverrides) {
|
||||||
if (configCLIOverrides.projects && userConfig.projects)
|
if (configCLIOverrides.projects && userConfig.projects)
|
||||||
|
|
@ -135,8 +133,6 @@ export class FullConfigInternal {
|
||||||
resolveProjectDependencies(this.projects);
|
resolveProjectDependencies(this.projects);
|
||||||
this._assignUniqueProjectIds(this.projects);
|
this._assignUniqueProjectIds(this.projects);
|
||||||
this.config.projects = this.projects.map(p => p.project);
|
this.config.projects = this.projects.map(p => p.project);
|
||||||
|
|
||||||
this.lastRunReporter = new LastRunReporter(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _assignUniqueProjectIds(projects: FullProjectInternal[]) {
|
private _assignUniqueProjectIds(projects: FullProjectInternal[]) {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import { currentBlobReportVersion, type BlobReportMetadata } from './blob';
|
||||||
import { relativeFilePath } from '../util';
|
import { relativeFilePath } from '../util';
|
||||||
import type { TestError } from '../../types/testReporter';
|
import type { TestError } from '../../types/testReporter';
|
||||||
import type * as blobV1 from './versions/blobV1';
|
import type * as blobV1 from './versions/blobV1';
|
||||||
|
import { LastRunReporter } from '../runner/lastRun';
|
||||||
|
|
||||||
type StatusCallback = (message: string) => void;
|
type StatusCallback = (message: string) => void;
|
||||||
|
|
||||||
|
|
@ -39,7 +40,8 @@ type ReportData = {
|
||||||
|
|
||||||
export async function createMergedReport(config: FullConfigInternal, dir: string, reporterDescriptions: ReporterDescription[], rootDirOverride: string | undefined) {
|
export async function createMergedReport(config: FullConfigInternal, dir: string, reporterDescriptions: ReporterDescription[], rootDirOverride: string | undefined) {
|
||||||
const reporters = await createReporters(config, 'merge', false, reporterDescriptions);
|
const reporters = await createReporters(config, 'merge', false, reporterDescriptions);
|
||||||
const multiplexer = new Multiplexer([...reporters, config.lastRunReporter]);
|
const lastRun = new LastRunReporter(config);
|
||||||
|
const multiplexer = new Multiplexer([...reporters, lastRun]);
|
||||||
const stringPool = new StringInternPool();
|
const stringPool = new StringInternPool();
|
||||||
|
|
||||||
let printStatus: StatusCallback = () => {};
|
let printStatus: StatusCallback = () => {};
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import { TestRun, createTaskRunner, createTaskRunnerForClearCache, createTaskRun
|
||||||
import type { FullConfigInternal } from '../common/config';
|
import type { FullConfigInternal } from '../common/config';
|
||||||
import { affectedTestFiles } from '../transform/compilationCache';
|
import { affectedTestFiles } from '../transform/compilationCache';
|
||||||
import { InternalReporter } from '../reporters/internalReporter';
|
import { InternalReporter } from '../reporters/internalReporter';
|
||||||
|
import { LastRunReporter } from './lastRun';
|
||||||
|
|
||||||
type ProjectConfigWithFiles = {
|
type ProjectConfigWithFiles = {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
@ -74,10 +75,11 @@ export class Runner {
|
||||||
webServerPluginsForConfig(config).forEach(p => config.plugins.push({ factory: p }));
|
webServerPluginsForConfig(config).forEach(p => config.plugins.push({ factory: p }));
|
||||||
|
|
||||||
const reporters = await createReporters(config, listOnly ? 'list' : 'test', false);
|
const reporters = await createReporters(config, listOnly ? 'list' : 'test', false);
|
||||||
|
const lastRun = new LastRunReporter(config);
|
||||||
if (config.cliLastFailed)
|
if (config.cliLastFailed)
|
||||||
await config.lastRunReporter.filterLastFailed();
|
await lastRun.filterLastFailed();
|
||||||
|
|
||||||
const reporter = new InternalReporter([...reporters, config.lastRunReporter]);
|
const reporter = new InternalReporter([...reporters, lastRun]);
|
||||||
const taskRunner = listOnly ? createTaskRunnerForList(
|
const taskRunner = listOnly ? createTaskRunnerForList(
|
||||||
config,
|
config,
|
||||||
reporter,
|
reporter,
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
import type { FullConfigInternal } from '../common/config';
|
import type { FullConfigInternal } from '../common/config';
|
||||||
import type { Suite, TestCase } from '../common/test';
|
import type { Suite, TestCase } from '../common/test';
|
||||||
import type { LastRunInfo } from './lastRun';
|
import { LastRunReporter, type LastRunInfo } from './lastRun';
|
||||||
|
|
||||||
export type TestGroup = {
|
export type TestGroup = {
|
||||||
workerHash: string;
|
workerHash: string;
|
||||||
|
|
@ -144,7 +144,8 @@ export async function filterForShard(config: FullConfigInternal, testGroups: Tes
|
||||||
if (mode === 'round-robin')
|
if (mode === 'round-robin')
|
||||||
return filterForShardRoundRobin(shard, testGroups);
|
return filterForShardRoundRobin(shard, testGroups);
|
||||||
if (mode === 'duration-round-robin') {
|
if (mode === 'duration-round-robin') {
|
||||||
const lastRunInfo = await config.lastRunReporter.lastRunInfo();
|
const lastRun = new LastRunReporter(config);
|
||||||
|
const lastRunInfo = await lastRun.lastRunInfo();
|
||||||
return filterForShardRoundRobin(shard, testGroups, lastRunInfo);
|
return filterForShardRoundRobin(shard, testGroups, lastRunInfo);
|
||||||
}
|
}
|
||||||
return filterForShardPartition(shard, testGroups);
|
return filterForShardPartition(shard, testGroups);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue