fix(graph): report a self-dependency as the cycle it is (GitHub #43)
A node that needs the token it provides is a cycle of one, so say so in the same words as every other cycle (`cycle detected: a -> a`), and name the token and the fix: cycle detected: auth -> auth (it needs 'user', which only it provides). Remove 'user' from its needs, or move the work that produces 'user' into a step it needs. "missing dependency … it provides it itself" pointed the reader at a missing producer, when the producer is there and the problem is the loop. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
4 files changed
+14
-9
No files matched your search
+1
-1
@@ -57,7 +57,7 @@ describe('one producer per token', () => {
|
||||
describe('self-dependency', () => {
|
||||
it('counts as missing when the token is not seeded', () => {
|
||||
expect(() => topoSort([node('auth', ['user'], ['user'])], [])).toThrow(
|
||||
/missing dependency: user needed by auth — it provides 'user' itself/,
|
||||
/cycle detected: auth -> auth \(it needs 'user', which only it provides\)/,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user