fix(cli): mount test file's directory so \ir includes resolve by Coly010 · Pull Request #5619 · supabase/cli · GitHub
Skip to content

fix(cli): mount test file's directory so \ir includes resolve#5619

Merged
Coly010 merged 1 commit into
developfrom
fix/4850-db-test-within-test
Jun 18, 2026
Merged

fix(cli): mount test file's directory so \ir includes resolve#5619
Coly010 merged 1 commit into
developfrom
fix/4850-db-test-within-test

Conversation

@Coly010

@Coly010 Coly010 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix.

What is the current behavior?

Running supabase db test <single_file.sql> fails when that file pulls in a sibling via psql's \ir ./other.sql include:

psql:.../storage_object_operations.sql:5: error: .../testing_constants.sql: No such file or directory

Running the whole suite (supabase db test) works, and so does running a file with no includes.

Root cause: buildLegacyPgProveArgs bind-mounted each test path exactly as given. For a single file that mounts only that one file into the pg_prove container. psql's \ir (include-relative) resolves relative to the test file's own directory, so it looks for <dir>/sibling.sql inside the container — which was never mounted. The whole-suite run works because the entire tests directory is mounted, so all siblings are present.

Closes #4850
Fixes CLI-1139

What is the new behavior?

When a test path is a file, its containing directory is bind-mounted read-only instead of the lone file, so \ir/\i siblings resolve. Directories are still mounted as-is. Binds are deduped by container target so multiple files in the same directory don't emit duplicate -v mounts (which Docker rejects). The full file path is still passed to pg_prove, so only the requested file runs and the TAP output is byte-identical.

Scope is the TS legacy port only (the stable channel). The Go reference has the same latent bug; this is a deliberate, output-preserving divergence noted in the code.

When `db test <file.sql>` was given a single file, only that file was
bind-mounted into the pg_prove container, so psql `\ir ./sibling.sql`
includes (which resolve relative to the test file's own directory)
failed with "No such file or directory". The whole-suite run worked
because the entire tests directory was mounted.

Mount the file's containing directory instead, deduped by container
target so multiple files in the same directory don't emit duplicate
`-v` mounts. The full file path is still passed to pg_prove, so only
the requested file runs and the TAP output is unchanged.

Closes #4850
Fixes CLI-1139
@Coly010 Coly010 requested a review from a team as a code owner June 18, 2026 13:20
@Coly010 Coly010 self-assigned this Jun 18, 2026
@github-actions

Copy link
Copy Markdown

@Coly010 Coly010 enabled auto-merge June 18, 2026 13:33
@Coly010 Coly010 added this pull request to the merge queue Jun 18, 2026
Merged via the queue into develop with commit e09cf29 Jun 18, 2026
19 checks passed
@Coly010 Coly010 deleted the fix/4850-db-test-within-test branch June 18, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no longer possible to run a single test file when it includes another

2 participants