这是indexloc提供的服务,不要输入任何密码
Skip to content

Scripts are run unnecessarily depending on how turbo is configured #937

@dcherman

Description

@dcherman

What version of Turborepo are you using?

1.1.9

What package manager are you using / does the bug impact?

Yarn v1

What operating system are you using?

Mac

Describe the Bug

When running a command like turbo run test, I would expect it to build the graph of tasks to run based on packages that actually define a test task. Instead, it seems like it assumes that all packages contain that task which results in needlessly running all tasks that would be dependencies.

In the case of the reproducer below, only the bar package contains a test script with a dependency on foo. The build task in baz was executed despite the output of it not being required for executing the requested tasks.

Expected Behavior

Only packages that actually contain the tasks to run should be considered when building the task graph.

To Reproduce

  1. Clone https://github.com/dcherman/turborepo-bad-script-reproducer
  2. yarn install
  3. yarn reproduce

Since only bar has a test script, I expected to see the build task from foo and bar run followed by the test task from bar. The build task of baz runs despite it having no test task and it not being a dependency of either of the other packages.

Here's an image of the graph that's generated from running turbo run test --graph

image

Note that the both the foo and baz tasks contain a node for the test task despite not actually defining a test task in package.json.

Metadata

Metadata

Assignees

Labels

area: ergonomicsIssues and features impacting the developer experience of using turboneeds: champion

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions