Skip to content

Commit

Permalink
Fix turbo run when --filter is provided and no packages are affected (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mehulkar authored Feb 22, 2023
1 parent 12e2727 commit f8bfa30
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
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?
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

1 comment on commit f8bfa30

@vercel
Copy link

@vercel vercel bot commented on f8bfa30 Feb 22, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.