-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix countPathsToRoot for cyclic graphs
`countPathsToRoot` reported incorrect results for cyclic graphs due to the interaction between caching and cycle breaking. You can't easily cache counts for intermediate traversal paths due to contextual cycle breaking, so just cache the final traversal counts.
- Loading branch information
Showing
7 changed files
with
308 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,234 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`pkgPathsToRoot cycles returns expected paths for all packages: a@1 1`] = ` | ||
Array [ | ||
Array [ | ||
Object { | ||
"name": "a", | ||
"version": "1", | ||
}, | ||
], | ||
] | ||
`; | ||
|
||
exports[`pkgPathsToRoot cycles returns expected paths for all packages: b@2 1`] = ` | ||
Array [ | ||
Array [ | ||
Object { | ||
"name": "b", | ||
"version": "2", | ||
}, | ||
Object { | ||
"name": "a", | ||
"version": "1", | ||
}, | ||
], | ||
] | ||
`; | ||
|
||
exports[`pkgPathsToRoot cycles returns expected paths for all packages: c@3 1`] = ` | ||
Array [ | ||
Array [ | ||
Object { | ||
"name": "c", | ||
"version": "3", | ||
}, | ||
Object { | ||
"name": "a", | ||
"version": "1", | ||
}, | ||
], | ||
] | ||
`; | ||
|
||
exports[`pkgPathsToRoot cycles returns expected paths for all packages: d@4 1`] = ` | ||
Array [ | ||
Array [ | ||
Object { | ||
"name": "d", | ||
"version": "4", | ||
}, | ||
Object { | ||
"name": "a", | ||
"version": "1", | ||
}, | ||
], | ||
] | ||
`; | ||
|
||
exports[`pkgPathsToRoot cycles returns expected paths for all packages: e@5 1`] = ` | ||
Array [ | ||
Array [ | ||
Object { | ||
"name": "e", | ||
"version": "5", | ||
}, | ||
Object { | ||
"name": "b", | ||
"version": "2", | ||
}, | ||
Object { | ||
"name": "a", | ||
"version": "1", | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"name": "e", | ||
"version": "5", | ||
}, | ||
Object { | ||
"name": "c", | ||
"version": "3", | ||
}, | ||
Object { | ||
"name": "a", | ||
"version": "1", | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"name": "e", | ||
"version": "5", | ||
}, | ||
Object { | ||
"name": "g", | ||
"version": "7", | ||
}, | ||
Object { | ||
"name": "f", | ||
"version": "6", | ||
}, | ||
Object { | ||
"name": "d", | ||
"version": "4", | ||
}, | ||
Object { | ||
"name": "a", | ||
"version": "1", | ||
}, | ||
], | ||
] | ||
`; | ||
|
||
exports[`pkgPathsToRoot cycles returns expected paths for all packages: f@6 1`] = ` | ||
Array [ | ||
Array [ | ||
Object { | ||
"name": "f", | ||
"version": "6", | ||
}, | ||
Object { | ||
"name": "d", | ||
"version": "4", | ||
}, | ||
Object { | ||
"name": "a", | ||
"version": "1", | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"name": "f", | ||
"version": "6", | ||
}, | ||
Object { | ||
"name": "e", | ||
"version": "5", | ||
}, | ||
Object { | ||
"name": "b", | ||
"version": "2", | ||
}, | ||
Object { | ||
"name": "a", | ||
"version": "1", | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"name": "f", | ||
"version": "6", | ||
}, | ||
Object { | ||
"name": "e", | ||
"version": "5", | ||
}, | ||
Object { | ||
"name": "c", | ||
"version": "3", | ||
}, | ||
Object { | ||
"name": "a", | ||
"version": "1", | ||
}, | ||
], | ||
] | ||
`; | ||
|
||
exports[`pkgPathsToRoot cycles returns expected paths for all packages: g@7 1`] = ` | ||
Array [ | ||
Array [ | ||
Object { | ||
"name": "g", | ||
"version": "7", | ||
}, | ||
Object { | ||
"name": "f", | ||
"version": "6", | ||
}, | ||
Object { | ||
"name": "d", | ||
"version": "4", | ||
}, | ||
Object { | ||
"name": "a", | ||
"version": "1", | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"name": "g", | ||
"version": "7", | ||
}, | ||
Object { | ||
"name": "f", | ||
"version": "6", | ||
}, | ||
Object { | ||
"name": "e", | ||
"version": "5", | ||
}, | ||
Object { | ||
"name": "b", | ||
"version": "2", | ||
}, | ||
Object { | ||
"name": "a", | ||
"version": "1", | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"name": "g", | ||
"version": "7", | ||
}, | ||
Object { | ||
"name": "f", | ||
"version": "6", | ||
}, | ||
Object { | ||
"name": "e", | ||
"version": "5", | ||
}, | ||
Object { | ||
"name": "c", | ||
"version": "3", | ||
}, | ||
Object { | ||
"name": "a", | ||
"version": "1", | ||
}, | ||
], | ||
] | ||
`; |
Oops, something went wrong.