Skip to content

Commit 6ff3000

Browse files
chore(pack): select workspace through config (#10010)
Backport of #9961 to `release/v11`. Co-authored-by: Tea Reggi <[email protected]> Copilot-Session: def7f84f-7065-4820-ad6d-ca0a6436655c
1 parent 0b3c699 commit 6ff3000

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎test/lib/commands/pack.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ t.test('invalid packument', async t => {
256256
})
257257

258258
t.test('workspaces', async t => {
259-
const loadWorkspaces = (t) => loadMockNpm(t, {
259+
const loadWorkspaces = (t, config = { workspaces: true }) => loadMockNpm(t, {
260260
prefixDir: {
261261
'package.json': JSON.stringify(
262262
{
@@ -281,7 +281,7 @@ t.test('workspaces', async t => {
281281
},
282282
},
283283
config: {
284-
workspaces: true,
284+
...config,
285285
// TODO: this is a workaround for npm run test-all
286286
// somehow leaking include-workspace-root
287287
'include-workspace-root': false,
@@ -301,8 +301,10 @@ t.test('workspaces', async t => {
301301
})
302302

303303
t.test('one workspace', async t => {
304-
const { npm, outputs } = await loadWorkspaces(t)
305-
await npm.exec('pack', ['workspace-a'])
304+
const { npm, outputs } = await loadWorkspaces(t, {
305+
workspace: ['workspace-a'],
306+
})
307+
await npm.exec('pack', [])
306308
t.strictSame(outputs, ['workspace-a-1.0.0.tgz'])
307309
})
308310

0 commit comments

Comments
 (0)