Vscode-jest: No tests found related to files changed since last commit.

Created on 4 Jan 2017  路  8Comments  路  Source: jest-community/vscode-jest

Hi!

I've installed the plugin, made sure I got this in package.json:

"test": "jest --watchAll --config node_modules/ca-ui-module-test/__jestDist__/jest.config"

But the runner keeps telling me all the time:

No tests found related to files changed since last commit.
Press `a` to run all tests, or run Jest with `--watchAll`.

I can do yarn test and everything works normally. Am I missing something? What should I look for? Is there anything I can activate that gives more more info?

Thanks!

Most helpful comment

npm test a

All 8 comments

Just to confirm, you understand how the watch mode works ( in that it only looks at tests related to the current git diff)?

So that I know whether this is a configuration problem or not

I just recently upgraded vscode to 1.8.1, and I am getting a similar response when I save my test files.

Here is my launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Tests",
            "type": "node",
            "request": "launch",
            "program": "${workspaceRoot}/node_modules/jest-cli/bin/jest.js",
            "stopOnEntry": false,
            "args": ["--runInBand"],
            "cwd": "${workspaceRoot}",
            "runtimeArgs": [
                "--debug-brk",
                "-i",
                "--colors"
            ],
            "env": {
                "NODE_ENV": "development"
            },
            "console": "internalConsole",
            "sourceMaps": true,
            "outFiles": ["${workspaceRoot}/dist/"]
        }
    ]
}

Here are my scripts from package.json:

"scripts": {
    "build": "npm run clean && webpack -p --config ./webpack.config.prod.js",
    "clean": "rm -rf ./dist",
    "start": "webpack-dev-server --config ./webpack.config.dev.js",
    "start:prod": "npm run build && NODE_ENV=production node ./src/server",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:coverage": "jest --coverage",
    "test:coverage:ci": "jest --coverage --runInBand"
  }

I'm also experiencing this with VS Code Version 1.13.1.
You can test with a new app created with https://github.com/wmonk/create-react-app-typescript.

The first screenshot shows that the file is seen by Git as dirty, but the VSCode-Jest does not register the changes.

Running the command straight from terminal (second screenshot) run the appropriate test.

Thanks for the wonderful plugin, and let me know if I can help in further debugging this issue.

screen shot 2017-07-08 at 22 31 01

screen shot 2017-07-08 at 22 28 36

^ This is like an issue at the Jest level, this extension is only running jest --watch with some extra CLI args at this point

@orta It was my mistake. I had to change pathToJest inside the workspace settings.
I initially didn't realize that I could set it to a command.

"jest.pathToJest": "npm test --"

If you'd like, I can make a PR making a note of this in the README.
Thanks again for your time!

Sure, yeah - better docs is always a great improvement!

Closing this stale issue. The Troubleshooting section of the README mentions pathToJest.

npm test a

Was this page helpful?
0 / 5 - 0 ratings

Related issues

connectdotz picture connectdotz  路  37Comments

Drakota picture Drakota  路  16Comments

ngauthier picture ngauthier  路  37Comments

qwerty2k picture qwerty2k  路  26Comments

tiagor87 picture tiagor87  路  16Comments