Skip to content

fix(runner): read git output with quotePath off for --only-changed - #43678

Closed
JohnnyXu (xubenqiang) wants to merge 1 commit into
microsoft:mainfrom
xubenqiang:fix/only-changed-non-ascii
Closed

JohnnyXu (xubenqiang) wants to merge 1 commit into
microsoft:mainfrom
xubenqiang:fix/only-changed-non-ascii

Conversation

@xubenqiang

Copy link
Copy Markdown

Fixes #43661

--only-changed asks git for the changed paths and treats each line as a file name. git quotes non-ascii paths by default (core.quotePath), so a changed cadastro-usuário.spec.ts comes back as "cadastro-usu\303\241rio.spec.ts", path.join makes a path that does not exist, and the file is not in the change set. The run then silently skips tests that changed - no error, just fewer tests than expected.

Change

packages/playwright/src/runner/vcs.ts: every git invocation in detectChangedTestFiles (and the shallow-clone probe) now passes -c core.quotePath=false, so paths come back exactly as they are on disk. This also restores the documented -c core.quotePath=false behaviour mentioned in the issue.

Test

tests/playwright-test/only-changed.spec.ts — should detect changed files whose names are not ascii: commits an ascii and a non-ascii spec, rewrites only the non-ascii one, runs with --only-changed and asserts the non-ascii file is selected and executed.

Verified on Windows 11 with the local build:

  • with the change: only-changed.spec.ts passes in full, 13 passed;
  • with vcs.ts reverted: the new test fails because the run selects nothing (exitCode 0 instead of 1).

Note: to run this suite locally I installed tests/playwright-test/stable-test-runner with pnpm (npm is not available in this environment) and used a locally patched utils/build/build.js that skips its npm ci step; neither change is part of the PR.

`detectChangedTestFiles` runs `git diff --name-only` and `git ls-files --others`
and treats each output line as a path. git quotes non-ascii paths by default
(`core.quotePath`), so a changed file named `cadastro-usuário.spec.ts` comes back
as `"cadastro-usu\303\241rio.spec.ts"` and never matches the real file. A run
with `--only-changed` then silently skips it - the changed tests do not run.

Both calls now pass `-c core.quotePath=false` (as does the shallow-clone probe),
so git prints the paths as they are on disk.

Test: `tests/playwright-test/only-changed.spec.ts` -
`should detect changed files whose names are not ascii` commits a repo with an
ascii and a non-ascii spec, rewrites only the non-ascii one, and asserts the
non-ascii file is selected. Verified red/green on Windows: without the change
the run selects nothing (exit code 0), with it the file is detected.
`only-changed.spec.ts` passes in full (13 tests).
Copilot AI balanced review requested due to automatic review settings October 27, 2026 17:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

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.

[Bug]: --only-changed skips changed test files with non-ASCII names

3 participants