File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -139,9 +139,11 @@ module.exports = cls => class Reifier extends cls {
139139 // of Node/Link trees
140140 log . warn ( 'reify' , 'The "linked" install strategy is EXPERIMENTAL and may contain bugs.' )
141141 this . idealTree = await this . createIsolatedTree ( )
142- this . #linkedActualForDiff = this . #buildLinkedActualForDiff(
143- this . idealTree , this . actualTree
144- )
142+ if ( this . actualTree ) {
143+ this . #linkedActualForDiff = this . #buildLinkedActualForDiff(
144+ this . idealTree , this . actualTree
145+ )
146+ }
145147 }
146148 await this [ _diffTrees ] ( )
147149 await this [ _reifyPackages ] ( )
Original file line number Diff line number Diff line change @@ -186,7 +186,28 @@ t.test('packageLockOnly can add deps', async t => {
186186 t . throws ( ( ) => fs . statSync ( path + '/node_modules' ) , { code : 'ENOENT' } )
187187} )
188188
189- t . test ( 'malformed package.json should not be overwitten' , async t => {
189+ t . test ( 'packageLockOnly with linked strategy in workspaces' , async t => {
190+ const path = t . testdir ( {
191+ 'package.json' : JSON . stringify ( {
192+ name : 'repro' ,
193+ private : true ,
194+ workspaces : [ 'packages/*' ] ,
195+ } ) ,
196+ packages : {
197+ a : {
198+ 'package.json' : JSON . stringify ( {
199+ name : 'a' ,
200+ version : '1.0.0' ,
201+ } ) ,
202+ } ,
203+ } ,
204+ } )
205+ await reify ( path , { packageLockOnly : true , installStrategy : 'linked' , registry } )
206+ t . ok ( fs . existsSync ( path + '/package-lock.json' ) , 'lock file created' )
207+ t . throws ( ( ) => fs . statSync ( path + '/node_modules' ) , { code : 'ENOENT' } )
208+ } )
209+
210+ t . test ( 'malformed package.json should not be overwritten' , async t => {
190211 t . plan ( 2 )
191212
192213 const path = fixture ( t , 'malformed-json' )
You can’t perform that action at this time.
0 commit comments