Skip to content

Read the config passed to wdio run - #2389

Merged
webpro merged 2 commits into
webpro-nl:mainfrom
everton-dgn:fix/wdio-run-config
Nov 17, 2026
Merged

webpro merged 2 commits into
webpro-nl:mainfrom
everton-dgn:fix/wdio-run-config

Conversation

@everton-dgn

Copy link
Copy Markdown
Contributor

In google-docs-to-markdown, wdio run ./wdio.conf.unit.js --coverage and wdio run ./wdio.conf.e2e.js leave the configs and the runner, framework and reporter packages they name reported as unused, since the plugin only looks for wdio.conf.{js,cjs,mjs,ts,cts,mts}.

wdio <config> is the same as wdio run <config> (source). The plugin now reads the config in both forms, and declares the boolean flags of run, such as --headless, so they don't take the path as their value. With the configs read, @wdio/config, which they import without listing it, shows up as unlisted.

@pkg-pr-new

pkg-pr-new Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: a80c33a

@webpro webpro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, Éverton! This picks up custom WDIO configs. Two supported flag aliases still need to be declared.


const args: Args = {
binaries: ['wdio'],
boolean: ['cpuProf', 'headless', 'heapProf'],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

WDIO's yargs parser also accepts --cpu-prof and --heap-prof, but only the camelCase forms are declared here. With wdio run --cpu-prof ./config/wdio.e2e.ts, Knip consumes the config filename as the flag's value, so the config and its framework dependency remain reported as unused. --heap-prof has the same issue.

Could you declare these aliases and add coverage with each flag before the config path?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Declared cpu-prof and heap-prof as aliases and added a case for each flag before the config path.

@webpro webpro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for adding both aliases and the regression cases, Éverton. --cpu-prof and --heap-prof now leave the config path intact. LGTM!

@webpro
webpro merged commit 29867da into webpro-nl:main Nov 17, 2026
33 checks passed
@webpro

webpro commented Nov 18, 2026

Copy link
Copy Markdown
Member

🚀 This pull request is included in v6.46.0. See Release 6.46.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.

2 participants