File tree 3 files changed +38
-2
lines changed
tap-snapshots/test/lib/commands
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 {
153
153
}
154
154
155
155
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 )
158
158
const node = edge . to || edge
159
159
const { path, location, package : { version : current } = { } } = node
160
160
Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ Package Current Wanted Latest Location Depended by
10
10
cat:dog@latest 1.0.0 2.0.0 2.0.0 node_modules/cat prefix
11
11
`
12
12
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
+
13
18
exports [ `test/lib/commands/outdated.js TAP should display outdated deps outdated --all > must match snapshot 1` ] = `
14
19
Package Current Wanted Latest Location Depended by
15
20
cat 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 => {
631
631
t . matchSnapshot ( joinedOutput ( ) , 'should display aliased outdated dep output' )
632
632
t . equal ( process . exitCode , 1 )
633
633
} )
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