Skip to content

Commit

Permalink
fix(core): run-one should not log undefined as target name on failure (
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Jan 10, 2023
1 parent 6fb0631 commit 06f334d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 21 deletions.
12 changes: 0 additions & 12 deletions packages/nx/src/command-line/run-many.spec.ts
Expand Up @@ -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(
{
Expand Down
8 changes: 3 additions & 5 deletions packages/nx/src/command-line/run-many.ts
Expand Up @@ -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()),
Expand Down
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -274,7 +274,7 @@ export async function createRunOneDynamicOutputRenderer({

const text = `Successfully ran ${formatTargetsAndProjects(
[initiatingProject],
[tasks[0].target.target],
[targetName],
tasks
)}`;

Expand Down
1 change: 0 additions & 1 deletion packages/nx/src/utils/command-line-utils.ts
Expand Up @@ -11,7 +11,6 @@ export interface RawNxArgs extends NxArgs {
}

export interface NxArgs {
target?: string;
targets?: string[];
configuration?: string;
runner?: string;
Expand Down

1 comment on commit 06f334d

@vercel
Copy link

@vercel vercel bot commented on 06f334d Jan 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx.dev

Please sign in to comment.