Skip to content

rtk jest drops a run argument anywhere in the line, so -t run loses its value #4431

Open

Description

@KuSh

rtk jest drops every argument that is exactly run, wherever it sits, so -t run loses its value and jest filters on the next argument instead.

The rewrite rule treats jest run … as a prefix (src/discover/rules.rs), so a leading run is already gone before rtk jest sees the arguments. A run later in the line survives the rewrite, and then the skip list in src/cmds/js/vitest_cmd.rs, which compares each argument on its own, removes it. jest 30, real project, LC_ALL=C:

$ rtk rewrite "jest -t run src/ok.test.js"
rtk jest -t run src/ok.test.js

$ npx jest -t run src/ok.test.js
Tests:       2 skipped, 2 total
Ran all test suites matching src/ok.test.js with tests matching "run".
exit 0

$ rtk jest -t run src/ok.test.js        # spawns: jest --no-watch --json -t src/ok.test.js
PASS (0) FAIL (0) skipped (6)
exit 0

-t now takes src/ok.test.js as the name pattern and the path filter is gone, so every suite runs. Open PR #3777 replaces the loop with strip_jest_conflicting_args, which keeps the same arg == "run" clause.

A fix drops run only as the first argument, matching the rewrite rule, and is pinned by a test on the argv for -t run.

Activity

  1. rtk-wshm-sync-bot commented on Oct 3, 2026

    @rtk-wshm-sync-bot

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟡 Priority medium
    🎯 Confidence 90%

    Summary

    rtk jest strips any argument equal to run anywhere in argv (not just a leading one), so -t run loses its value and the test-name filter breaks; fix should match the leading-only rewrite rule in rules.rs.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/cmds/js/vitest_cmd.rs
    • src/discover/rules.rs

    Suggested Actions

    1. Restrict the arg == "run" strip in src/cmds/js/vitest_cmd.rs to only the first argument
    2. Check open PR fix(jest): consume the values a stripped --reporters flag would bind #3777's strip_jest_conflicting_args — it reintroduces the same run-anywhere bug
    3. Add a regression test pinning argv for -t run src/ok.test.js

    Triaged automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions