@@ -303,6 +303,49 @@ t.test('transplant workspace targets, even if links not present', async t => {
303303 } ) , 'do not transplant node named "a"' )
304304} )
305305
306+ t . test ( 'linked strategy propagates dep flags into undeclared workspaces' , async t => {
307+ // Undeclared workspaces aren't in root node_modules under linked; without the fix their edges resolve to null and stay dev.
308+ // `tools` is also a devDependency of `app`, so it is reached by both a prod root link and a dev `app` link.
309+ // `app` is linked into root node_modules, so its edge already resolves and the synthesis is skipped.
310+ const path = t . testdir ( {
311+ 'package.json' : JSON . stringify ( {
312+ name : 'root' ,
313+ workspaces : [ 'packages/*' ] ,
314+ } ) ,
315+ node_modules : {
316+ '@test' : {
317+ app : t . fixture ( 'symlink' , '../../packages/app' ) ,
318+ } ,
319+ } ,
320+ packages : {
321+ app : {
322+ 'package.json' : JSON . stringify ( {
323+ name : '@test/app' ,
324+ version : '1.0.0' ,
325+ devDependencies : { '@test/tools' : '*' } ,
326+ } ) ,
327+ node_modules : {
328+ '@test' : {
329+ tools : t . fixture ( 'symlink' , '../../../tools' ) ,
330+ } ,
331+ } ,
332+ } ,
333+ tools : {
334+ 'package.json' : JSON . stringify ( {
335+ name : '@test/tools' ,
336+ version : '1.0.0' ,
337+ } ) ,
338+ } ,
339+ } ,
340+ } )
341+ const tree = await loadActual ( path , { installStrategy : 'linked' } )
342+ const byLocation = loc => [ ...tree . inventory . values ( ) ] . find ( n => n . location === loc )
343+ const app = byLocation ( 'packages/app' )
344+ const tools = byLocation ( 'packages/tools' )
345+ t . equal ( app . dev , false , 'app workspace is prod' )
346+ t . equal ( tools . dev , false , 'tools workspace is prod, not overwritten by the dev app link' )
347+ } )
348+
306349t . test ( 'load workspaces when loading from hidden lockfile' , async t => {
307350 const path = t . testdir ( {
308351 'package.json' : JSON . stringify ( {
0 commit comments