Repository navigation
fix(@schematics/angular): accept the project as a positional argument in refactor-jasmine-vitest - #34605
Closed
MeAkib wants to merge 1 commit into
Closed
fix(@schematics/angular): accept the project as a positional argument in refactor-jasmine-vitest#34605MeAkib wants to merge 1 commit into
MeAkib wants to merge 1 commit into
Conversation
… in refactor-jasmine-vitest The karma-to-vitest migration suggests running `ng g @schematics/angular:refactor-jasmine-vitest <project_name>`, but the schematic only accepts the project through the `--project` option, so the suggested command fails with `Unknown argument`. Read the project from the first positional argument. When it is not provided, the schematic still uses the only project of the workspace.
There was a problem hiding this comment.
Code Review
This pull request updates the schema for the jasmine-vitest refactoring schematic to accept the project name as a positional argument from the command line arguments. The reviewer pointed out that this change introduces a usability regression because the CLI will no longer automatically resolve the project from the current working directory in multi-project workspaces. To resolve this, the reviewer suggested adding a hidden workingDirectory option and provided a code implementation to handle the fallback logic in the schematic.
Collaborator
|
Thanks for this, but thinking about this a bit more, this will break the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #34387, where @alan-agius4 noted that the schematic should accept the positional argument.
The karma-to-vitest migration suggests running ng g @schematics/angular:refactor-jasmine-vitest <project_name>, but the schematic only accepts the project through the --project option, so the suggested command fails with Unknown argument.
Read the project from the first positional argument. When it is not provided, the schematic still uses the only project of the workspace.
Note: an option can only have one $default, so the project is no longer inferred from the current directory ($source: projectName). In a multi-project workspace, running the schematic without a project name now reports the available projects instead. If keeping that inference is preferred, it could be done with a hidden workingDirectory option as suggested by the bot. Happy to add it.