Skip to content

fix(playwright): resolve globalSetup/globalTeardown from config dir - #2076

Merged
webpro merged 1 commit into
webpro-nl:mainfrom
alokn:fix/playwright-global-setup-config-dir
Sep 30, 2026
Merged

webpro merged 1 commit into
webpro-nl:mainfrom
alokn:fix/playwright-global-setup-config-dir

Conversation

@alokn

@alokn alokn commented Sep 30, 2026

Copy link
Copy Markdown

Fixes #2072.

Playwright resolves relative globalSetup/globalTeardown paths against the config file's directory. The plugin passed them to toEntry without changing them, so they were resolved from the workspace root. With a config in a subdirectory (e2e/playwright.config.ts + globalSetup: './support/setup.ts'), the setup file was reported as unused.

The fix resolves these paths with toAbsolute(id, configFileDir), which is what the oxlint plugin already does. Absolute paths are still passed through unchanged.

The new fixture plugins/playwright3 reproduces the bug: before the fix, e2e/support/global-setup.ts and global-teardown.ts are reported as unused files.

🤖 Generated with Claude Code

Playwright resolves relative globalSetup and globalTeardown paths against
the config file's directory. Knip resolved them from the workspace root,
so with a config in a subdirectory the files were reported as unused.

Closes webpro-nl#2072

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pkg-pr-new

pkg-pr-new Bot commented Sep 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/knip@2076
npm i https://pkg.pr.new/@knip/language-server@2076
npm i https://pkg.pr.new/@knip/mcp@2076

commit: 35ea5c0

@webpro
webpro merged commit 7060bb9 into webpro-nl:main Sep 30, 2026
32 checks passed
@webpro

webpro commented Sep 30, 2026

Copy link
Copy Markdown
Member

Thank you 🧡

@webpro

webpro commented Sep 30, 2026

Copy link
Copy Markdown
Member

🚀 This pull request is included in v6.39.0. See Release 6.39.0 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

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.

🐛 Playwright plugin: relative globalSetup/globalTeardown resolved from cwd, not the config's directory

2 participants