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
2 changes: 2 additions & 0 deletions workspaces/arborist/lib/audit-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ class AuditReport extends Map {
if (
!node.version ||
node.isRoot ||
node.isLink ||
node.linksIn?.size > 0 ||
(this.filterSet && this.filterSet?.size !== 0 && !this.filterSet?.has(node))
) {
return false
Expand Down
23 changes: 23 additions & 0 deletions workspaces/arborist/test/audit-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,29 @@ t.test('audit supports alias deps', async t => {
t.equal(report.get('mkdirp').simpleRange, '0.4.1 - 0.5.1')
})

t.test('linked local package should not be audited against the registry', async t => {
const path = resolve(fixtures, 'audit-linked-package')
// No registry.audit() mock needed — no request should be made
// because linked packages must be excluded from the bulk payload
createRegistry(t)
const cache = t.testdir()
const arb = newArb(path, { cache })

const tree = await arb.loadVirtual()
const report = await AuditReport.load(tree, arb.options)

t.equal(
report.has('electron-test-app'),
false,
'linked local package should not appear in audit report'
)
t.equal(
report.size,
0,
'audit report should be empty when all dependencies are local links'
)
})

t.test('audit with filterSet limiting to only mkdirp and minimist', async t => {
const path = resolve(fixtures, 'audit-nyc-mkdirp')
const registry = createRegistry(t)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "audit-linked-package",
"dependencies": {
"electron-test-app": "1.0.0"
}
}
Loading