Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

AgentEnder
Copy link
Member

Current Behavior

Running nx run nx:test --help and nx test nx --help behave differently

Expected Behavior

They are equivalent

Related Issue(s)

Fixes #

@AgentEnder AgentEnder requested a review from a team as a code owner September 8, 2025 22:04
Copy link

vercel bot commented Sep 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Sep 10, 2025 4:08pm

Copy link
Contributor

nx-cloud bot commented Sep 8, 2025

View your CI Pipeline Execution ↗ for commit c411f22

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ❌ Failed 1h 26m 49s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 2m 3s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 6s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 5s View ↗
nx documentation ✅ Succeeded 1m 27s View ↗

☁️ Nx Cloud last updated this comment at 2025-09-10 17:28:45 UTC

@@ -112,7 +112,7 @@ export const commandsObject = yargs
.command(resolveConformanceCommandObject())
.command(resolveConformanceCheckCommandObject())
.scriptName('nx')
.help()
.help(false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Disabling the built-in yargs help handler with .help(false) removes the automatic --help flag processing for all commands. This appears to contradict the test expectations where Nx commands like nx graph --help and nx affected --help should display Nx's help output.

For this approach to work correctly, custom help handling logic needs to be implemented that:

  1. Preserves help functionality for native Nx commands
  2. Allows --help flags to pass through to underlying tools for infix commands

Without such custom logic, the tests in the PR will likely fail since they expect different help behavior depending on the command type. Consider implementing a custom help handler that differentiates between Nx commands and infix/run commands.

Suggested change
.help(false)
.help()
.middleware((argv) => {
// Custom help handling logic
if (argv.help) {
// For native Nx commands, show Nx help
// For infix/run commands, pass --help to the underlying tool
const command = argv._[0];
if (!command || nxCommands.includes(command)) {
// This is a native Nx command, show help and exit
yargs.showHelp();
process.exit(0);
}
// For infix commands, let the --help flag pass through
}
})

Spotted by Diamond

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant