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

Issue #8664 | Bug 🐛: --match-path does not work with watch mode: cannot be used multiple times #8664 #8709

Merged
merged 5 commits into from
Aug 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions crates/forge/bin/cmd/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ pub async fn watch_snapshot(args: SnapshotArgs) -> Result<()> {
pub async fn watch_test(args: TestArgs) -> Result<()> {
let config: Config = args.build_args().into();
let filter = args.filter(&config);

// Check if any of the filters are present
let path_pattern_exists = filter.args().path_pattern.is_some();

// Marker to check whether to override the command.
let _no_reconfigure = filter.args().test_pattern.is_some() ||
Copy link
Member

Choose a reason for hiding this comment

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

I think we should just use no_reconfigure here, looks like this was used earlier to avoid updating the command if any filters were set

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done ✅, thank you for the review 👍🏾

Copy link
Member

Choose a reason for hiding this comment

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

please remove newlines and I think there's no need for underscore in var name name

filter.args().path_pattern.is_some() ||
Expand Down Expand Up @@ -302,8 +306,11 @@ pub async fn watch_test(args: TestArgs) -> Result<()> {
}

trace!(?file, "reconfigure test command");

command.arg("--match-path").arg(&file);

// Before appending `--match-path`, check if it already exists
if !path_pattern_exists {
command.arg("--match-path").arg(file);
}
},
)?;
run(config).await?;
Expand Down Expand Up @@ -383,3 +390,4 @@ mod tests {
assert_eq!(cleaned, vec!["-v".to_string()]);
}
}

PabloVillaplana marked this conversation as resolved.
Show resolved Hide resolved