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');
|
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', () => {
|
it('should exclude projects', () => {
|
||||||
const projects = projectsToRun(
|
const projects = projectsToRun(
|
||||||
{
|
{
|
||||||
|
|||||||
@ -82,16 +82,14 @@ export function projectsToRun(
|
|||||||
|
|
||||||
if (invalidProjects.length > 0) {
|
if (invalidProjects.length > 0) {
|
||||||
output.warn({
|
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}`),
|
bodyLines: invalidProjects.map((name) => `- ${name}`),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedProjects.size === 0) {
|
|
||||||
throw new Error(`No projects found for project patterns`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const excludedProjects = findMatchingProjects(
|
const excludedProjects = findMatchingProjects(
|
||||||
nxArgs.exclude ?? [],
|
nxArgs.exclude ?? [],
|
||||||
Array.from(selectedProjects.keys()),
|
Array.from(selectedProjects.keys()),
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export async function createRunOneDynamicOutputRenderer({
|
|||||||
}: {
|
}: {
|
||||||
initiatingProject: string;
|
initiatingProject: string;
|
||||||
tasks: Task[];
|
tasks: Task[];
|
||||||
args: { target?: string; configuration?: string; parallel?: number };
|
args: { configuration?: string; parallel?: number };
|
||||||
overrides: Record<string, unknown>;
|
overrides: Record<string, unknown>;
|
||||||
}): Promise<{ lifeCycle: LifeCycle; renderIsDone: Promise<void> }> {
|
}): Promise<{ lifeCycle: LifeCycle; renderIsDone: Promise<void> }> {
|
||||||
cliCursor.hide();
|
cliCursor.hide();
|
||||||
@ -79,7 +79,7 @@ export async function createRunOneDynamicOutputRenderer({
|
|||||||
const totalDependentTasksNotFromInitiatingProject =
|
const totalDependentTasksNotFromInitiatingProject =
|
||||||
totalTasks - totalTasksFromInitiatingProject;
|
totalTasks - totalTasksFromInitiatingProject;
|
||||||
|
|
||||||
const targetName = args.target;
|
const targetName = tasks[0].target.target;
|
||||||
|
|
||||||
let dependentTargetsNumLines = 0;
|
let dependentTargetsNumLines = 0;
|
||||||
let totalCompletedTasks = 0;
|
let totalCompletedTasks = 0;
|
||||||
@ -274,7 +274,7 @@ export async function createRunOneDynamicOutputRenderer({
|
|||||||
|
|
||||||
const text = `Successfully ran ${formatTargetsAndProjects(
|
const text = `Successfully ran ${formatTargetsAndProjects(
|
||||||
[initiatingProject],
|
[initiatingProject],
|
||||||
[tasks[0].target.target],
|
[targetName],
|
||||||
tasks
|
tasks
|
||||||
)}`;
|
)}`;
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,6 @@ export interface RawNxArgs extends NxArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface NxArgs {
|
export interface NxArgs {
|
||||||
target?: string;
|
|
||||||
targets?: string[];
|
targets?: string[];
|
||||||
configuration?: string;
|
configuration?: string;
|
||||||
runner?: string;
|
runner?: string;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user