@@ -1187,6 +1187,55 @@ t.test('workspaces', t => {
11871187 t . test ( 'reify simple-workspaces' , t =>
11881188 t . resolveMatchSnapshot ( printReified ( fixture ( t , 'workspaces-simple' ) ) , 'should reify simple workspaces' ) )
11891189
1190+ t . test ( 'reify workspaces omit dev dependencies' , async t => {
1191+ const runCase = async ( t , opts ) => {
1192+ const path = fixture ( t , 'workspaces-conflicting-dev-deps' )
1193+ const rootAjv = resolve ( path , 'node_modules/ajv/package.json' )
1194+ const ajvOfPkgA = resolve ( path , 'a/node_modules/ajv/package.json' )
1195+ const ajvOfPkgB = resolve ( path , 'b/node_modules/ajv/package.json' )
1196+
1197+ t . equal ( fs . existsSync ( rootAjv ) , true , 'root ajv exists' )
1198+ t . equal ( fs . existsSync ( ajvOfPkgA ) , true , 'ajv under package a node_modules exists' )
1199+ t . equal ( fs . existsSync ( ajvOfPkgB ) , true , 'ajv under package a node_modules exists' )
1200+
1201+ await reify ( path , { omit : [ 'dev' ] , ...opts } )
1202+
1203+ return {
1204+ root : { exists : ( ) => fs . existsSync ( rootAjv ) } ,
1205+ a : { exists : ( ) => fs . existsSync ( ajvOfPkgA ) } ,
1206+ b : { exists : ( ) => fs . existsSync ( ajvOfPkgB ) } ,
1207+ }
1208+ }
1209+
1210+ await t . test ( 'default' , async t => {
1211+ const { root, a, b } = await runCase ( t )
1212+ t . equal ( root . exists ( ) , false , 'root' )
1213+ t . equal ( a . exists ( ) , false , 'a' )
1214+ t . equal ( b . exists ( ) , false , 'b' )
1215+ } )
1216+
1217+ await t . test ( 'workspaces only' , async t => {
1218+ const { root, a, b } = await runCase ( t , { workspaces : [ 'a' ] } )
1219+ t . equal ( root . exists ( ) , false , 'root' )
1220+ t . equal ( a . exists ( ) , false , 'a' )
1221+ t . equal ( b . exists ( ) , true , 'b' )
1222+ } )
1223+
1224+ await t . test ( 'workspaces + root' , async t => {
1225+ const { root, a, b } = await runCase ( t , { workspaces : [ 'a' ] , includeWorkspaceRoot : true } )
1226+ t . equal ( root . exists ( ) , false , 'root' )
1227+ t . equal ( a . exists ( ) , false , 'a' )
1228+ t . equal ( b . exists ( ) , true , 'b' )
1229+ } )
1230+
1231+ await t . test ( 'disable workspaces' , async t => {
1232+ const { root, a, b } = await runCase ( t , { workspacesEnabled : false } )
1233+ t . equal ( root . exists ( ) , false , 'root' )
1234+ t . equal ( a . exists ( ) , true , 'a' )
1235+ t . equal ( b . exists ( ) , true , 'b' )
1236+ } )
1237+ } )
1238+
11901239 t . test ( 'reify workspaces lockfile' , async t => {
11911240 const path = fixture ( t , 'workspaces-simple' )
11921241 await reify ( path )
0 commit comments