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

Fix turbo run when --filter is provided and no packages are affected #3901

Merged
merged 3 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 16 additions & 0 deletions cli/integration_tests/basic_monorepo/filter-run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Setup
$ . ${TESTDIR}/../setup.sh
$ . ${TESTDIR}/setup.sh $(pwd)

# Running with --filter works and exits
$ ${TURBO} run build --filter=main
\xe2\x80\xa2 Packages in scope: (esc)
\xe2\x80\xa2 Running build in 0 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

No tasks were executed as part of this run.

Tasks: 0 successful, 0 total
Cached: 0 cached, 0 total
Time:\s*[\.0-9]+m?s (re)

7 changes: 7 additions & 0 deletions cli/internal/core/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ func (e *Engine) Prepare(options *EngineBuildingOptions) error {
taskNames := options.TaskNames
tasksOnly := options.TasksOnly

// If there are no affected packages, we don't need to go through all this work
// we can just exit early.
// TODO(mehulkar): but we still need to validate bad task names?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This TODO in #3902, so we don't block this PR

if len(pkgs) == 0 {
return nil
}

traversalQueue := []string{}

// get a set of taskNames passed in. we'll remove the ones that have a definition
Expand Down