Start replacement
This commit is contained in:
parent
2ce354635f
commit
e3c0cfb827
|
|
@ -175,6 +175,7 @@ export class FullProjectInternal {
|
|||
this.snapshotPathTemplate = takeFirst(projectConfig.snapshotPathTemplate, config.snapshotPathTemplate, defaultSnapshotPathTemplate);
|
||||
|
||||
this.project = {
|
||||
globalTimeout: fullConfig.config.globalTimeout,
|
||||
grep: takeFirst(projectConfig.grep, config.grep, defaultGrep),
|
||||
grepInvert: takeFirst(projectConfig.grepInvert, config.grepInvert, null),
|
||||
outputDir: takeFirst(configCLIOverrides.outputDir, pathResolve(configDir, projectConfig.outputDir), pathResolve(configDir, config.outputDir), path.join(throwawayArtifactsPath, 'test-results')),
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ export type EnvProducedPayload = [string, string | null][];
|
|||
|
||||
export function serializeConfig(config: FullConfigInternal, passCompilationCache: boolean): SerializedConfig {
|
||||
const result: SerializedConfig = {
|
||||
location: { configDir: config.configDir, resolvedConfigFile: config.config.configFile },
|
||||
location: { configDir: config.configDir, resolvedConfigFile: config.config.projects[0]?.configFile },
|
||||
configCLIOverrides: config.configCLIOverrides,
|
||||
compilationCache: passCompilationCache ? serializeCompilationCache() : undefined,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ export class BaseReporter implements ReporterV2 {
|
|||
}
|
||||
|
||||
protected generateStartingMessage() {
|
||||
const jobs = this.config.metadata.actualWorkers ?? this.config.workers;
|
||||
const jobs = this.config.metadata.actualWorkers ?? this.config.projects[0].workers;
|
||||
const shardDetails = this.config.shard ? `, shard ${this.config.shard.current} of ${this.config.shard.total}` : '';
|
||||
if (!this.totalTestCount)
|
||||
return '';
|
||||
|
|
@ -195,7 +195,7 @@ export class BaseReporter implements ReporterV2 {
|
|||
if (expected)
|
||||
tokens.push(colors.green(` ${expected} passed`) + colors.dim(` (${milliseconds(this.result.duration)})`));
|
||||
if (this.result.status === 'timedout')
|
||||
tokens.push(colors.red(` Timed out waiting ${this.config.globalTimeout / 1000}s for the entire test run`));
|
||||
tokens.push(colors.red(` Timed out waiting ${this.config.projects[0].globalTimeout / 1000}s for the entire test run`));
|
||||
if (fatalErrors.length && expected + unexpected.length + interrupted.length + flaky.length > 0)
|
||||
tokens.push(colors.red(` ${fatalErrors.length === 1 ? '1 error was not a part of any test' : fatalErrors.length + ' errors were not a part of any test'}, see above for details`));
|
||||
|
||||
|
|
|
|||
|
|
@ -231,8 +231,8 @@ class JSONReporter extends EmptyReporter {
|
|||
async function outputReport(report: JSONReport, config: FullConfig, outputFile: string | undefined) {
|
||||
const reportString = JSON.stringify(report, undefined, 2);
|
||||
if (outputFile) {
|
||||
assert(config.configFile || path.isAbsolute(outputFile), 'Expected fully resolved path if not using config file.');
|
||||
outputFile = config.configFile ? path.resolve(path.dirname(config.configFile), outputFile) : outputFile;
|
||||
assert(config.projects[0]?.configFile || path.isAbsolute(outputFile), 'Expected fully resolved path if not using config file.');
|
||||
outputFile = config.projects[0]?.configFile ? path.resolve(path.dirname(config.projects[0]?.configFile), outputFile) : outputFile;
|
||||
await fs.promises.mkdir(path.dirname(outputFile), { recursive: true });
|
||||
await fs.promises.writeFile(outputFile, reportString);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ class JUnitReporter extends EmptyReporter {
|
|||
this.timestamp = new Date();
|
||||
this.startTime = monotonicTime();
|
||||
if (this.outputFile) {
|
||||
assert(this.config.configFile || path.isAbsolute(this.outputFile), 'Expected fully resolved path if not using config file.');
|
||||
this.resolvedOutputFile = this.config.configFile ? path.resolve(path.dirname(this.config.configFile), this.outputFile) : this.outputFile;
|
||||
assert(this.config.projects[0]?.configFile || path.isAbsolute(this.outputFile), 'Expected fully resolved path if not using config file.');
|
||||
this.resolvedOutputFile = this.config.projects[0]?.configFile ? path.resolve(path.dirname(this.config.projects[0]?.configFile), this.outputFile) : this.outputFile;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ export async function createRootSuite(testRun: TestRun, errors: TestError[], sho
|
|||
if (config.config.forbidOnly) {
|
||||
const onlyTestsAndSuites = rootSuite._getOnlyItems();
|
||||
if (onlyTestsAndSuites.length > 0) {
|
||||
const configFilePath = config.config.configFile ? path.relative(config.config.rootDir, config.config.configFile) : undefined;
|
||||
const configFilePath = config.config.projects[0]?.configFile ? path.relative(config.config.rootDir, config.config.projects[0]?.configFile) : undefined;
|
||||
errors.push(...createForbidOnlyErrors(onlyTestsAndSuites, config.configCLIOverrides.forbidOnly, configFilePath));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ export class Runner {
|
|||
async runAllTests(): Promise<FullResult['status']> {
|
||||
const config = this._config;
|
||||
const listOnly = config.cliListOnly;
|
||||
const deadline = config.config.globalTimeout ? monotonicTime() + config.config.globalTimeout : 0;
|
||||
const deadline = config.config.projects[0].globalTimeout ? monotonicTime() + config.config.projects[0].globalTimeout : 0;
|
||||
|
||||
// Legacy webServer support.
|
||||
webServerPluginsForConfig(config).forEach(p => config.plugins.push({ factory: p }));
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ export class TestRun {
|
|||
}
|
||||
|
||||
export function createTaskRunner(config: FullConfigInternal, reporter: ReporterV2): TaskRunner<TestRun> {
|
||||
const taskRunner = new TaskRunner<TestRun>(reporter, config.config.globalTimeout);
|
||||
const taskRunner = new TaskRunner<TestRun>(reporter, config.config.projects[0].globalTimeout);
|
||||
addGlobalSetupTasks(taskRunner, config);
|
||||
taskRunner.addTask('load tests', createLoadTask('in-process', { filterOnly: true, failOnLoadErrors: true }));
|
||||
addRunTasks(taskRunner, config);
|
||||
|
|
@ -109,14 +109,14 @@ function addRunTasks(taskRunner: TaskRunner<TestRun>, config: FullConfigInternal
|
|||
}
|
||||
|
||||
export function createTaskRunnerForList(config: FullConfigInternal, reporter: ReporterV2, mode: 'in-process' | 'out-of-process', options: { failOnLoadErrors: boolean }): TaskRunner<TestRun> {
|
||||
const taskRunner = new TaskRunner<TestRun>(reporter, config.config.globalTimeout);
|
||||
const taskRunner = new TaskRunner<TestRun>(reporter, config.config.projects[0].globalTimeout);
|
||||
taskRunner.addTask('load tests', createLoadTask(mode, { ...options, filterOnly: false }));
|
||||
taskRunner.addTask('report begin', createReportBeginTask());
|
||||
return taskRunner;
|
||||
}
|
||||
|
||||
export function createTaskRunnerForListFiles(config: FullConfigInternal, reporter: ReporterV2): TaskRunner<TestRun> {
|
||||
const taskRunner = new TaskRunner<TestRun>(reporter, config.config.globalTimeout);
|
||||
const taskRunner = new TaskRunner<TestRun>(reporter, config.config.projects[0].globalTimeout);
|
||||
taskRunner.addTask('load tests', createListFilesTask());
|
||||
taskRunner.addTask('report begin', createReportBeginTask());
|
||||
return taskRunner;
|
||||
|
|
@ -283,7 +283,7 @@ function createPhasesTask(): Task<TestRun> {
|
|||
testRun.phases.push(phase);
|
||||
for (const project of phaseProjects) {
|
||||
const projectSuite = projectToSuite.get(project)!;
|
||||
const testGroups = createTestGroups(projectSuite, testRun.config.config.workers);
|
||||
const testGroups = createTestGroups(projectSuite, project.project.workers);
|
||||
phase.projects.push({ project, projectSuite, testGroups });
|
||||
testGroupsInPhase += testGroups.length;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ export const FiltersView: React.FC<{
|
|||
const copy = new Map(projectFilters);
|
||||
copy.set(projectName, !copy.get(projectName));
|
||||
setProjectFilters(copy);
|
||||
const configFile = testModel?.config?.configFile;
|
||||
const configFile = testModel?.config?.projects[0]?.configFile;
|
||||
if (configFile)
|
||||
settings.setObject(configFile + ':projects', [...copy.entries()].filter(([_, v]) => v).map(([k]) => k));
|
||||
}}/>
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ export const UIModeView: React.FC<{}> = ({
|
|||
return;
|
||||
|
||||
const { config, rootSuite } = testModel;
|
||||
const selectedProjects = config.configFile ? settings.getObject<string[] | undefined>(config.configFile + ':projects', undefined) : undefined;
|
||||
const selectedProjects = config.projects[0]?.configFile ? settings.getObject<string[] | undefined>(config.projects[0]?.configFile + ':projects', undefined) : undefined;
|
||||
const newFilter = new Map(projectFilters);
|
||||
for (const projectName of newFilter.keys()) {
|
||||
if (!rootSuite.suites.find(s => s.title === projectName))
|
||||
|
|
|
|||
Loading…
Reference in a new issue