File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -871,13 +871,9 @@ module.exports = cls => class Reifier extends cls {
871
871
return relative ( dir , resolve ( rootDir , overridePath ) )
872
872
}
873
873
874
- // Fallback: derive the package name from node.resolved in a platform-agnostic way
874
+ // Fallback: derive the file path from node.resolved in a platform-agnostic way
875
875
const filePath = node . resolved . replace ( / ^ f i l e : / , '' )
876
- // A node.package.name could be different than the folder name
877
- const pathParts = filePath . split ( / [ \\ / ] / )
878
- const packageName = pathParts [ pathParts . length - 1 ]
879
-
880
- return join ( '..' , packageName )
876
+ return join ( filePath )
881
877
}
882
878
883
879
#registryResolved ( resolved ) {
Original file line number Diff line number Diff line change @@ -3209,7 +3209,7 @@ t.test('root overrides with file: paths are visible to workspaces', async t => {
3209
3209
const path = t . testdir ( {
3210
3210
'package.json' : JSON . stringify ( {
3211
3211
name : 'root' ,
3212
- workspaces : [ 'hello' ] ,
3212
+ workspaces : [ 'hello' , 'nested/goodbye' ] ,
3213
3213
dependencies : { } ,
3214
3214
overrides : {
3215
3215
print : 'file:./print' ,
@@ -3224,6 +3224,17 @@ t.test('root overrides with file: paths are visible to workspaces', async t => {
3224
3224
} ,
3225
3225
} ) ,
3226
3226
} ,
3227
+ nested : {
3228
+ goodbye : {
3229
+ 'package.json' : JSON . stringify ( {
3230
+ name : 'second' ,
3231
+ version : '1.0.0' ,
3232
+ dependencies : {
3233
+ print : '../print' ,
3234
+ } ,
3235
+ } ) ,
3236
+ } ,
3237
+ } ,
3227
3238
print : {
3228
3239
'package.json' : JSON . stringify ( {
3229
3240
name : 'print' ,
@@ -3237,6 +3248,7 @@ t.test('root overrides with file: paths are visible to workspaces', async t => {
3237
3248
await reify ( path )
3238
3249
3239
3250
const printSymlink = fs . readlinkSync ( resolve ( path , 'node_modules/print' ) )
3251
+ const secondSymlink = fs . readlinkSync ( resolve ( path , 'node_modules/second' ) )
3240
3252
3241
3253
// Create a platform-agnostic way to compare symlink targets
3242
3254
const normalizeLinkTarget = target => {
@@ -3254,6 +3266,12 @@ t.test('root overrides with file: paths are visible to workspaces', async t => {
3254
3266
'../print' ,
3255
3267
'print symlink points to ../print (normalized for platform)'
3256
3268
)
3269
+
3270
+ t . equal (
3271
+ normalizeLinkTarget ( secondSymlink ) ,
3272
+ '../nested/goodbye' ,
3273
+ 'print symlink points to ../nested/goodbye (normalized for platform)'
3274
+ )
3257
3275
} )
3258
3276
3259
3277
t . test ( 'should preserve exact ranges, missing actual tree' , async ( t ) => {
You can’t perform that action at this time.
0 commit comments