@@ -3343,6 +3343,24 @@ t.test('should preserve exact ranges, missing actual tree', async (t) => {
33433343 } ,
33443344 } )
33453345
3346+ const customGitSshPackument = JSON . stringify ( {
3347+ _id : 'gitssh' ,
3348+ _rev : 'lkjadflkjasdf' ,
3349+ name : 'gitssh' ,
3350+ 'dist-tags' : { latest : '1.1.1' } ,
3351+ versions : {
3352+ '1.1.1' : {
3353+ name : 'gitssh' ,
3354+ version : '1.1.1' ,
3355+ dist : {
3356+ // this is a url that `new URL()` cant parse
3357+ // https://github.com/npm/cli/issues/5278
3358+ tarball : 'git+ssh://git@customgit.com:a/b/c.git#lkjadflkjasdf' ,
3359+ } ,
3360+ } ,
3361+ } ,
3362+ } )
3363+
33463364 const notAUrlPackument = JSON . stringify ( {
33473365 _id : 'notaurl' ,
33483366 _rev : 'lkjadflkjasdf' ,
@@ -3359,6 +3377,36 @@ t.test('should preserve exact ranges, missing actual tree', async (t) => {
33593377 } ,
33603378 } )
33613379
3380+ t . test ( 'valid custom hosted git url' , async ( t ) => {
3381+ const testdir = t . testdir ( {
3382+ project : {
3383+ 'package.json' : JSON . stringify ( {
3384+ name : 'myproject' ,
3385+ version : '1.0.0' ,
3386+ dependencies : {
3387+ gitssh : '1.1.1' ,
3388+ } ,
3389+ } ) ,
3390+ } ,
3391+ } )
3392+
3393+ tnock ( t , 'https://registry.github.com' )
3394+ . get ( '/gitssh' )
3395+ . reply ( 200 , customGitSshPackument )
3396+
3397+ const getLogs = warningTracker ( )
3398+
3399+ const arb = new Arborist ( {
3400+ path : resolve ( testdir , 'project' ) ,
3401+ registry : 'https://registry.github.com' ,
3402+ cache : resolve ( testdir , 'cache' ) ,
3403+ } )
3404+ await arb . reify ( )
3405+ // since it's not throwing an error on invalid url and returning undefined
3406+ // which trashes the node, so here we can only check if it has no warnings
3407+ t . strictSame ( getLogs ( ) , [ ] , 'did not get warnings' )
3408+ } )
3409+
33623410 t . test ( 'host should not be replaced replaceRegistryHost=never' , async ( t ) => {
33633411 const testdir = t . testdir ( {
33643412 project : {
0 commit comments