Skip to content

[BUG] Project is being captured as a dependency even though it is not #125

@pemsbr

Description

@pemsbr

Describe the bug
A project is wrongly captured as a dependency when it starts with the same name as a project that is actually a dependency.

To Reproduce
Steps to reproduce the behavior:

  1. Create 3 projects (dep-project, dep-project-foo, target-project)
    libs/
    ├─ target-project/TargetProject.csproj
    ├─ dep-project-foo/DepProject.Foo.csproj
    ├─ dep-project/DepProject.csproj

  2. Add dep-project-foo as a project reference in target-project

  3. Run nx dep-graph

  4. Not only is dep-project-foo a dependency of target-project but also dep-project

Expected behavior
target-project should only have one dependency: dep-project-foo

Additional context
I think the problem is here:

if (workspaceFilePath.startsWith(path)) {

Comparing against `${path}\\` appears to fix the issue.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingneeds-triageThis issue has yet to be looked over by a core team memberoutdated

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions