File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,9 +117,11 @@ module.exports = cls => class Reifier extends cls {
117117 // of Node/Link trees
118118 log . warn ( 'reify' , 'The "linked" install strategy is EXPERIMENTAL and may contain bugs.' )
119119 this . idealTree = await this . createIsolatedTree ( )
120- this . #linkedActualForDiff = this . #buildLinkedActualForDiff(
121- this . idealTree , this . actualTree
122- )
120+ if ( this . actualTree ) {
121+ this . #linkedActualForDiff = this . #buildLinkedActualForDiff(
122+ this . idealTree , this . actualTree
123+ )
124+ }
123125 }
124126 await this [ _diffTrees ] ( )
125127 await this . #reifyPackages( )
Original file line number Diff line number Diff line change @@ -199,6 +199,28 @@ t.test('packageLockOnly can add deps', async t => {
199199 t . throws ( ( ) => fs . statSync ( path + '/node_modules' ) , { code : 'ENOENT' } )
200200} )
201201
202+ t . test ( 'packageLockOnly with linked strategy in workspaces' , async t => {
203+ const path = t . testdir ( {
204+ 'package.json' : JSON . stringify ( {
205+ name : 'repro' ,
206+ private : true ,
207+ workspaces : [ 'packages/*' ] ,
208+ } ) ,
209+ packages : {
210+ a : {
211+ 'package.json' : JSON . stringify ( {
212+ name : 'a' ,
213+ version : '1.0.0' ,
214+ } ) ,
215+ } ,
216+ } ,
217+ } )
218+ createRegistry ( t , false )
219+ await reify ( path , { packageLockOnly : true , installStrategy : 'linked' } )
220+ t . ok ( fs . existsSync ( path + '/package-lock.json' ) , 'lock file created' )
221+ t . throws ( ( ) => fs . statSync ( path + '/node_modules' ) , { code : 'ENOENT' } )
222+ } )
223+
202224t . test ( 'malformed package.json should not be overwritten' , async t => {
203225 t . plan ( 2 )
204226
You can’t perform that action at this time.
0 commit comments