File tree Expand file tree Collapse file tree 3 files changed +38
-2
lines changed
tap-snapshots/test/lib/commands Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -153,8 +153,8 @@ class Outdated extends ArboristWorkspaceCmd {
153153 }
154154
155155 async #getOutdatedInfo ( edge ) {
156- const alias = safeNpa ( edge . spec ) ?. subSpec ?. name
157- const spec = npa ( alias ?? edge . name )
156+ const alias = safeNpa ( edge . spec ) ?. subSpec
157+ const spec = npa ( alias ? alias . name : edge . name )
158158 const node = edge . to || edge
159159 const { path, location, package : { version : current } = { } } = node
160160
Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ Package Current Wanted Latest Location Depended by
1010cat:dog@latest 1.0.0 2.0.0 2.0.0 node_modules/cat prefix
1111`
1212
13+ exports [ `test/lib/commands/outdated.js TAP aliases with version range > should display aliased outdated dep output with correct wanted values 1` ] = `
14+ Package Current Wanted Latest Location Depended by
15+ cat:dog@^1.0.0 1.0.0 1.0.1 2.0.0 node_modules/cat prefix
16+ `
17+
1318exports [ `test/lib/commands/outdated.js TAP should display outdated deps outdated --all > must match snapshot 1` ] = `
1419Package Current Wanted Latest Location Depended by
1520cat 1.0.0 1.0.1 1.0.1 node_modules/cat prefix
Original file line number Diff line number Diff line change @@ -631,3 +631,34 @@ t.test('aliases', async t => {
631631 t . matchSnapshot ( joinedOutput ( ) , 'should display aliased outdated dep output' )
632632 t . equal ( process . exitCode , 1 )
633633} )
634+
635+ t . test ( 'aliases with version range' , async t => {
636+ const testDir = {
637+ 'package.json' : JSON . stringify ( {
638+ name : 'display-aliases' ,
639+ version : '1.0.0' ,
640+ dependencies : {
641+ cat : 'npm:dog@^1.0.0' ,
642+ } ,
643+ } ) ,
644+ node_modules : {
645+ cat : {
646+ 'package.json' : JSON . stringify ( {
647+ name : 'dog' ,
648+ version : '1.0.0' ,
649+ } ) ,
650+ } ,
651+ } ,
652+ }
653+
654+ const { outdated, joinedOutput } = await mockNpm ( t , {
655+ prefixDir : testDir ,
656+ } )
657+ await outdated . exec ( [ ] )
658+
659+ t . matchSnapshot (
660+ joinedOutput ( ) ,
661+ 'should display aliased outdated dep output with correct wanted values'
662+ )
663+ t . equal ( process . exitCode , 1 )
664+ } )
You can’t perform that action at this time.
0 commit comments