From 30c5b55d4a61e81acac64f70944124745da1dc95 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Thu, 25 Jun 2026 00:17:14 +0530 Subject: [PATCH] test(ls): cover linked strategy dev-edge guard to restore 100% coverage --- test/lib/commands/ls.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/lib/commands/ls.js b/test/lib/commands/ls.js index 577c2e7835e2a..cf99c3b889a6f 100644 --- a/test/lib/commands/ls.js +++ b/test/lib/commands/ls.js @@ -5462,6 +5462,37 @@ t.test('ls --install-strategy=linked', async t => { t.match(output, /nopt/, 'should list the dependency') }) + t.test('should not report devDeps of linked transitive packages as UNMET DEPENDENCY', async t => { + const { result, ls } = await mockLs(t, { + config: { + 'install-strategy': 'linked', + all: true, + }, + prefixDir: { + 'package.json': JSON.stringify({ + name: 'test-linked-transitive', + version: '1.0.0', + dependencies: { 'pkg-a': 'file:./pkg-a' }, + }), + 'pkg-a': { + 'package.json': JSON.stringify({ + name: 'pkg-a', + version: '1.0.0', + devDependencies: { tap: '^16.0.0' }, + }), + }, + node_modules: { + 'pkg-a': t.fixture('symlink', '../pkg-a'), + }, + }, + }) + await ls.exec([]) + const output = cleanCwd(result()) + t.notMatch(output, /UNMET DEPENDENCY/, 'should not report devDeps of linked transitive packages') + t.notMatch(output, /tap/, 'should not traverse devDeps of linked transitive packages') + t.match(output, /pkg-a/, 'should list the dependency') + }) + t.test('should still report declared workspace as UNMET DEPENDENCY when missing', async t => { const { ls } = await mockLs(t, { config: {