Repository navigation
fix(runner): read git output with quotePath off for --only-changed - #43678
Closed
JohnnyXu (xubenqiang) wants to merge 1 commit into
Closed
JohnnyXu (xubenqiang) wants to merge 1 commit into
JohnnyXu (xubenqiang) wants to merge 1 commit into
Conversation
`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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #43661
--only-changedasks git for the changed paths and treats each line as a file name. git quotes non-ascii paths by default (core.quotePath), so a changedcadastro-usuário.spec.tscomes back as"cadastro-usu\303\241rio.spec.ts",path.joinmakes 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 indetectChangedTestFiles(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=falsebehaviour 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-changedand asserts the non-ascii file is selected and executed.Verified on Windows 11 with the local build:
only-changed.spec.tspasses in full, 13 passed;vcs.tsreverted: the new test fails because the run selects nothing (exitCode0 instead of 1).Note: to run this suite locally I installed
tests/playwright-test/stable-test-runnerwith pnpm (npm is not available in this environment) and used a locally patchedutils/build/build.jsthat skips itsnpm cistep; neither change is part of the PR.