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:
parent
6fb0631126
commit
06f334d7ce
@ -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(
|
||||
{
|
||||
|
||||
@ -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()),
|
||||
|
||||
@ -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
|
||||
)}`;
|
||||
|
||||
|
||||
@ -11,7 +11,6 @@ export interface RawNxArgs extends NxArgs {
|
||||
}
|
||||
|
||||
export interface NxArgs {
|
||||
target?: string;
|
||||
targets?: string[];
|
||||
configuration?: string;
|
||||
runner?: string;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user