fix(core): run-one should not log undefined as target name on failure (#14238)

Fixes https://github.com/nrwl/nx/issues/14158
This commit is contained in:
Craigory Coppola 2023-01-10 10:51:07 -05:00 committed by GitHub
parent 6fb0631126
commit 06f334d7ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 21 deletions

View File

@ -71,18 +71,6 @@ describe('run-many', () => {
expect(projects).toContain('proj2');
});
it('should throw for invalid patterns', () => {
expect(() => {
projectsToRun(
{
targets: ['test'],
projects: ['nomatch*'],
},
projectGraph
).map(({ name }) => name);
}).toThrow();
});
it('should exclude projects', () => {
const projects = projectsToRun(
{

View File

@ -82,16 +82,14 @@ export function projectsToRun(
if (invalidProjects.length > 0) {
output.warn({
title: `the following do not have configuration for "${nxArgs.target}"`,
title: `The following projects do not have a configuration for any of the provided targets ("${nxArgs.targets.join(
', '
)}")`,
bodyLines: invalidProjects.map((name) => `- ${name}`),
});
}
}
if (selectedProjects.size === 0) {
throw new Error(`No projects found for project patterns`);
}
const excludedProjects = findMatchingProjects(
nxArgs.exclude ?? [],
Array.from(selectedProjects.keys()),

View File

@ -39,7 +39,7 @@ export async function createRunOneDynamicOutputRenderer({
}: {
initiatingProject: string;
tasks: Task[];
args: { target?: string; configuration?: string; parallel?: number };
args: { configuration?: string; parallel?: number };
overrides: Record<string, unknown>;
}): Promise<{ lifeCycle: LifeCycle; renderIsDone: Promise<void> }> {
cliCursor.hide();
@ -79,7 +79,7 @@ export async function createRunOneDynamicOutputRenderer({
const totalDependentTasksNotFromInitiatingProject =
totalTasks - totalTasksFromInitiatingProject;
const targetName = args.target;
const targetName = tasks[0].target.target;
let dependentTargetsNumLines = 0;
let totalCompletedTasks = 0;
@ -274,7 +274,7 @@ export async function createRunOneDynamicOutputRenderer({
const text = `Successfully ran ${formatTargetsAndProjects(
[initiatingProject],
[tasks[0].target.target],
[targetName],
tasks
)}`;

View File

@ -11,7 +11,6 @@ export interface RawNxArgs extends NxArgs {
}
export interface NxArgs {
target?: string;
targets?: string[];
configuration?: string;
runner?: string;