Skip to content

Remove fragile --test-args parsing, pass unknown args directly to vitest#42

Merged
danelkay93 merged 2 commits into
codex/optimize-bleedy-environment-configurationfrom
copilot/sub-pr-41
Nov 6, 2025
Merged

Remove fragile --test-args parsing, pass unknown args directly to vitest#42
danelkay93 merged 2 commits into
codex/optimize-bleedy-environment-configurationfrom
copilot/sub-pr-41

Conversation

Copilot AI commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

The --test-args= implementation split values by spaces, breaking arguments containing spaces even when quoted (e.g., --grep "test pattern").

Changes

  • Remove --test-args= special handling and error on unknown options
  • Treat all unrecognized arguments as vitest passthrough args
  • Update help text to reflect cleaner interface

Before/After

# Before: fragile, breaks on spaces
npm run qa -- --test-args='--run --coverage'
npm run qa -- --test-args='--grep "my test"'  # BROKEN

# After: robust, preserves shell quoting
npm run qa -- --run --coverage
npm run qa -- --grep "my test pattern"

Arguments now rely on shell's native parsing instead of custom string splitting.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai

coderabbitai Bot commented Nov 6, 2025

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Note

Free review on us!

CodeRabbit is offering free reviews until Fri Nov 07 2025 to showcase some of the refinements we've made.

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: danelkay93 <24777308+danelkay93@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on argument parsing for legacy docs Remove fragile --test-args parsing, pass unknown args directly to vitest Nov 6, 2025
Copilot AI requested a review from danelkay93 November 6, 2025 09:58
@danelkay93 danelkay93 marked this pull request as ready for review November 6, 2025 10:12
Copilot AI review requested due to automatic review settings November 6, 2025 10:12

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.

Pull Request Overview

This PR simplifies the argument handling in the agent-check.mjs script by removing the explicit --test-args flag and instead treating all unrecognized arguments as passthrough arguments for Vitest. This makes the CLI more intuitive and follows standard npm argument passing conventions.

Key Changes:

  • Removed the --test-args= flag parsing logic
  • Changed unknown argument handling from erroring to passthrough
  • Updated help text to reflect the new argument passing pattern

@danelkay93 danelkay93 requested a review from Copilot November 6, 2025 10:14

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/agent-check.mjs
Comment on lines +18 to +19
// Treat unknown arguments as passthrough args for vitest
passthroughArgs.push(arg);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Handle -- separator instead of forwarding it to Vitest

The new parsing loop now pushes every unrecognized token into passthroughArgs, including the literal --. When running QA with both script flags and Vitest flags (e.g. npm run qa -- --skip-build -- --grep "pattern"), the loop forwards ['--', '--grep', 'pattern'] and line 55 prepends another --. vitest therefore receives npm run test:unit -- -- --grep pattern --passWithNoTests, where the second -- stops option parsing and all subsequent flags (--grep, --passWithNoTests, etc.) are ignored. Custom test arguments no longer work and the safety flag --passWithNoTests is lost whenever passthrough args are used. The parser should treat -- as a separator (stop parsing and exclude it) before building testArgs.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@copilot Fix this

@danelkay93 danelkay93 merged commit af14def into codex/optimize-bleedy-environment-configuration Nov 6, 2025
14 of 17 checks passed

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.

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@danelkay93 danelkay93 deleted the copilot/sub-pr-41 branch November 6, 2025 10:16
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.

3 participants