fix(cli)!: resolve include patterns relative to Playwright config directory#1309
Merged
sorccu merged 6 commits intoMay 21, 2026
Conversation
…ectory Include glob patterns in bundlePlayWrightProject were resolved relative to Session.basePath (workspace root) instead of the Playwright config file's directory. This caused patterns like 'fixtures/**' to look in the wrong location when the Playwright config lived in a subdirectory. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…right config Update getAutoIncludes unit tests for the new globCwd parameter and add coverage for subdirectory scenarios. Add integration test with a fixture where the Playwright config lives in a subdirectory to verify include patterns resolve correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…undles Verify that pnpm patch files are auto-included in Playwright check bundles for both the root case and the subdirectory case where the Playwright config lives in a nested directory. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Verify that absolute file paths in the PlaywrightCheck include property are supported. Uses a .check.ts file with import.meta.url to compute the absolute path dynamically at runtime. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…form The skipIf checks for default node_modules and .git ignore patterns only matched patterns starting with the directory name. This missed patterns using parent traversal or absolute paths. Use a helper that checks for the directory name as a path segment anywhere in the pattern. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
812ffd8 to
e99399c
Compare
…indows path.join produces backslash paths on Windows, but glob requires forward slashes. Normalize patterns in findFilesWithPattern before passing them to glob. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merged
sorccu
added a commit
that referenced
this pull request
May 22, 2026
…ectory (#1309) * fix(cli)!: resolve include patterns relative to Playwright config directory Include glob patterns in bundlePlayWrightProject were resolved relative to Session.basePath (workspace root) instead of the Playwright config file's directory. This caused patterns like 'fixtures/**' to look in the wrong location when the Playwright config lived in a subdirectory. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * test(cli): add tests for include pattern resolution relative to Playwright config Update getAutoIncludes unit tests for the new globCwd parameter and add coverage for subdirectory scenarios. Add integration test with a fixture where the Playwright config lives in a subdirectory to verify include patterns resolve correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * test(cli): add integration tests for pnpm patches auto-inclusion in bundles Verify that pnpm patch files are auto-included in Playwright check bundles for both the root case and the subdirectory case where the Playwright config lives in a nested directory. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * test(cli): add integration test for absolute paths in include Verify that absolute file paths in the PlaywrightCheck include property are supported. Uses a .check.ts file with import.meta.url to compute the absolute path dynamically at runtime. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(cli): detect explicit include of ignored dirs regardless of path form The skipIf checks for default node_modules and .git ignore patterns only matched patterns starting with the directory name. This missed patterns using parent traversal or absolute paths. Use a helper that checks for the directory name as a path segment anywhere in the pattern. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(cli): normalize include patterns to forward slashes for glob on Windows path.join produces backslash paths on Windows, but glob requires forward slashes. Normalize patterns in findFilesWithPattern before passing them to glob. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
checks.includeand per-checkPlaywrightCheckProps.include) are now resolved relative to the Playwright config file's directory instead of the workspace root (Session.basePath). This fixes incorrect file matching when the Playwright config lives in a subdirectory (e.g. monorepo setups).patches/*.patchfiles are still bundled correctly.node_modulesor.gitregardless of path form (parent traversal, absolute paths), not just patterns starting with the directory name.Other changes
.gitignore pattern changed from.git/**to**/.git/**for cwd-independence, consistent with**/node_modules/**.Breaking change
includepatterns are now resolved relative to the directory containing the Playwright config file, not the project root. Users withplaywrightConfigPathpointing to a subdirectory who wroteincludepatterns relative to the project root will need to adjust them.Test plan
basePath === dir, no behavior change)includework via MaC.check.tsgetAutoIncludesunit tests updated for newglobCwdparameter + subdirectory cases🤖 Generated with Claude Code