Skip to content

[BUG]? Running a specific test/group sometimes runs all tests #1278

Description

@zacaj

Describe the bug
There are many situations where I click on a test and select 'Run Test', but instead, all tests in the file get run

To Reproduce
(simplest method I can find, but there seem to be multiple things that cause it)
Steps to reproduce the behavior:

  1. Disable auto-running tests
  2. Create a test file with two tests inside of it, note that they show up in the test explorer on the left once you save even though tests don't auto run
  3. Select just one of the tests, and select 'Run Test'
  4. The entire file is run, --testNamePattern is not present in the command

(if at this point you try to Run Test on that same test again, it works correctly for a while)

Expected behavior
Only the test that I ran should run (or if I click on a describe block, only that describe block should run)

Environment (please complete the following information):

  • vscode-jest version: 6.4.4
  • node -v:v22.16.0
  • npm -v : 10.9.2
  • pnpm -v: 10.11.0
  • jest or react-scripts (if you haven’t ejected) version: jest 29.7.0
  • your vscode-jest settings:
    "jest.runMode": {
    "runAllTestsOnStartup": false,
    "coverage": false,
    "deferred": false,
    "showInlineError": true,
    "type": "on-demand",
    "testFileOnly": true
    },
  • Operating system: Fedora

Prerequisite

  • are you able to run jest from the command line? yes
  • where do you run jest CLI from? root directory
  • how do you run your tests from the command line? pnpm test

Additional context

Very unfamiliar with the codebase but if you have a suspicion about where the bug lies that you can point me to, i can poke at it and hopefully make a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions