Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

affected / run-many watch flag to match run's watch flag #2107

Closed
jdugas opened this issue Apr 25, 2024 · 2 comments · Fixed by #2129
Closed

affected / run-many watch flag to match run's watch flag #2107

jdugas opened this issue Apr 25, 2024 · 2 comments · Fixed by #2129
Assignees
Labels
type: feature New feature or request

Comments

@jdugas
Copy link

jdugas commented Apr 25, 2024

Description

Currently nx console allows me to run unit tests with the ability to change the watch boolean flag by way of the set flags menu prompt before the command is executed. I would like to also be able to set the watch boolean flag when using affected test and run-many tests.
I know this can be done becuase running the commands in the console does work.

For example: npx nx affected --target=test --watch=true

Motivation

We have many developers that like to click through the menus from nx console to run the commands rather than remember all the possible command combinations and type them out through the terminal. That seems to be the point of using nx console to begin with. This seems like a feature that it should have.

Suggested Implementation

I would like to be able to select and set the "watch" flag from the nx console menu "execute command or set flags" that comes up after I select the 'affected' or 'run-many' commands from the "common nx commands" menu.

Alternate Implementations

My suggestion goes with how it functions for the regular 'run' command found in the 'generate & run target' section. I would expect it to work the same. The only other way I can think of would be to have the run command be changed so that after selecting run I then select an option for run-many or run-affected followed by all the same options from the run flags menu.

@jdugas jdugas added the type: feature New feature or request label Apr 25, 2024
@MaxKless MaxKless self-assigned this Apr 26, 2024
@MaxKless
Copy link
Collaborator

MaxKless commented May 6, 2024

Hello :)
I think I misunderstood this issue a bit - let me ask for clarification.
You're referring to the watch flag that the executor (that runs the target) uses under the hood, right?

When we're running a single target, we know for sure what the executor is going to be so we can extract the necessary options and allow them as flags.
When we're running multiple targets via affected or run-many, we don't necessarily know which projects are going to be run with the target. And since test could mean very different things (some projects use jest, others vitest, others cypress or something custom with run-commands), we can't provide the options as nicely.

However, we can add the ability to support specifying arbitrary flags in there. So even if we can't make assumptions about the existence of a watch option, we'll allow you to specify it.

I'll try to work on that this week :)

@MaxKless
Copy link
Collaborator

MaxKless commented May 8, 2024

I've added the ability to add arbitrary flags in the above PR.
While this doesn't show you what you can run nicely in the quickpick as before, it gives you the option to specify it yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants