Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/vx/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -3705,6 +3705,8 @@ So a config that reads the environment keeps its lock-time values.
(an install's `node_modules`), a config-less project's too.
- Under `--affected`, only when a task the diff reaches is its, or depends
on one of its: a change elsewhere runs as usual.
- `vx show` and the picker list it as the lock holds it; picked, the run
is refused.
- Only a repository where a sparse checkout was set asks git about a
config-less project's directory: one spawn per run.
- The refusal names every such project, and the one
Expand Down
4 changes: 3 additions & 1 deletion packages/vx/src/cli/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,9 @@ export async function pickTask(
// The staged load: a task a `project` plugin gave a config-less package
// is on the menu, as it is in a run.
const root = await findWorkspaceRoot(cwd)
const staged = await loadCliProjects(root, projects, 'all', load)
// A task of a project a sparse checkout left out is listed: picked, the
// run names the checkout.
const staged = await loadCliProjects(root, projects, 'all', { ...load, sparseLeft: new Map() })
const entries: PickedTask[] = []
for (const meta of projects) {
if (only !== undefined && !only.has(meta.name)) continue
Expand Down
7 changes: 6 additions & 1 deletion packages/vx/src/cli/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,12 @@ export async function showCmd(args: readonly string[]): Promise<number> {
}
}

const projects = await loadCliProjects(root, metas, scope, { closure: true })
// A project a sparse checkout left out is shown as the lock holds it: what
// a run would read once it is checked out.
const projects = await loadCliProjects(root, metas, scope, {
closure: true,
sparseLeft: new Map(),
})

if (parsed.target === undefined) {
if (metas.length === 0)
Expand Down
13 changes: 13 additions & 0 deletions packages/vx/tests/sparse-checkout-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@ it('--affected refuses the excluded project only when what it reaches needs it',
expect([app.code, app.out.includes('built'), app.err.trim()]).toEqual([1, false, REFUSAL])
}, 30_000)

it('vx show lists and prints the excluded project as the lock holds it', async () => {
// Every `vx show` but one of a kept project was refused.
const list = await vx(root, ['show', '--format', 'json'])
expect([list.code, JSON.parse(list.out).map((p: { name: string }) => p.name)]).toEqual([
0,
['app', 'lib', 'other'],
])
for (const target of ['lib', 'lib#build', 'build']) {
const r = await vx(root, ['show', target])
expect([target, r.code, r.out.includes('lib#build'), r.err]).toEqual([target, 0, true, ''])
}
}, 30_000)

it('vx lock and its --check refuse what the sparse checkout left out, the lock untouched', async () => {
const lockFile = path.join(root, '.vx/projects.lock')
const before = await Bun.file(lockFile).text()
Expand Down
Loading