Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion workspaces/arborist/lib/arborist/build-ideal-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ module.exports = cls => class IdealTreeBuilder extends cls {
return
}
for (const node of this.idealTree.inventory.values()) {
if (!node.isWorkspace) {
// a workspace is in the inventory as both a Link and its target node; warn once by skipping the link
if (!node.isWorkspace || node.isLink) {
continue
}
if (node.package.packageExtensions !== undefined) {
Expand Down
7 changes: 5 additions & 2 deletions workspaces/arborist/test/arborist/package-extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,11 @@ t.test('does not extend workspace members but warns', async t => {
const tree = await buildIdeal(path)
const ws = [...tree.inventory.values()].find(n => n.name === 'ws')
t.notOk(ws.edgesOut.get('bar'), 'workspace member is not extended')
t.ok(warnings.some(w => /workspace package ws/.test(w[2])), 'warns about the workspace selector match')
t.ok(warnings.some(w => /in workspace ws is ignored/.test(w[2])), 'warns about non-root workspace packageExtensions')
// a workspace appears in the inventory as both a Link and its target node, so the warning must be deduped to fire once
t.equal(warnings.filter(w => /workspace package ws/.test(w[2])).length, 1,
'warns exactly once about the workspace selector match')
t.equal(warnings.filter(w => /in workspace ws is ignored/.test(w[2])).length, 1,
'warns exactly once about non-root workspace packageExtensions')
})

t.test('ignores packageExtensions from an installed dependency', async t => {
Expand Down
Loading