Skip to content

Commit

Permalink
Merge pull request #50 from snyk/fix/fix-label-pruning-bug
Browse files Browse the repository at this point in the history
fix: Fix label instance reuse bug during pruning
  • Loading branch information
darscan committed Mar 6, 2020
2 parents 2cb43d5 + c6f41ba commit 24f0506
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/legacy/index.ts
Expand Up @@ -283,7 +283,7 @@ async function buildSubtree(
depTree.versionProvenance = nodeInfo.versionProvenance;
}
if (nodeInfo.labels) {
depTree.labels = nodeInfo.labels;
depTree.labels = { ...nodeInfo.labels };
}

const depInstanceIds = depGraph.getNodeDepsNodeIds(nodeId);
Expand Down
7 changes: 7 additions & 0 deletions test/fixtures/pruneable-tree-multi-top-level-deps-pruned.json
Expand Up @@ -22,6 +22,9 @@
"vuln": "yes"
}
}
},
"labels": {
"foo": "bar"
}
}
}
Expand All @@ -34,6 +37,7 @@
"name": "c",
"version": "1.0.0",
"labels": {
"foo": "bar",
"pruned": "true"
}
}
Expand All @@ -60,6 +64,9 @@
"vuln": "yes"
}
}
},
"labels": {
"foo": "bar"
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions test/fixtures/pruneable-tree-multi-top-level-deps.json
Expand Up @@ -22,6 +22,9 @@
"vuln": "yes"
}
}
},
"labels": {
"foo": "bar"
}
}
}
Expand All @@ -41,6 +44,9 @@
"vuln": "yes"
}
}
},
"labels": {
"foo": "bar"
}
}
}
Expand All @@ -66,6 +72,9 @@
"vuln": "yes"
}
}
},
"labels": {
"foo": "bar"
}
}
}
Expand Down

0 comments on commit 24f0506

Please sign in to comment.