How to fix Jest "No tests found" on windows 10?

I try to use Jest on my Windows 10 desktop, but it keeps telling me that there are no tests. On my windows 10 laptop it works fine. Here is the result that I get on my desktop:

C:\app> jest
No tests found
In C:\app
   25163 files checked.
   testMatch: **/__tests__/**/*.js?(x),**/?(*.)(spec|test).js?(x) - 743 matches
   testPathIgnorePatterns: \\node_modules\\ - 25163 matches
Pattern: "" - 0 matches

In my package.json file, my jest configuration looks like this:

"jest": {
  "collectCoverageFrom": [
    "app/**/*.{js,jsx}",
    "!app/**/*.test.{js,jsx}",
    "!app/*/RbGenerated*/*.{js,jsx}",
    "!app/app.js"
  ],
  "coverageThreshold": {
    "global": {
      "statements": 98,
      "branches": 91,
      "functions": 98,
      "lines": 98
    }
  },
  "moduleDirectories": [
    "node_modules",
    "app",
    "common"
  ],
  "moduleNameMapper": {
    ".*\\.(css|less|styl|scss|sass)$": "<rootDir>/internals/mocks/cssModule.js",
    ".*\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/internals/mocks/image.js"
  },
  "setupTestFrameworkScriptFile": "<rootDir>/internals/testing/test-bundler.js"
}

I am using node 8.1.4 and jest v20.0.4 Any ideas on how to get a joke to find my tests?

+5
source share
4 answers

I am not 100% sure that this is the same problem. But for me, it decided to get rid of the watchman (I added it along the way for another project that used a relay). Try running with --no-watchman (or install watchman: false in jest config)

+3

, , , Jest, ​​ v22.

Changelog: https://github.com/facebook/jest/blob/master/CHANGELOG.md (PR # 5054)

+1

-- --watch package.json, "test" : "jest -- --watch"

0

jest test/components/checkBox/treezCheckBox.test.js

.

jest test\components\checkBox\treezCheckBox.test.js

No tests found, exiting with code 1
Run with '--passWithNoTests' to exit with code 0
In D:\treezjs
  814 files checked.
  testMatch: **/__tests__/**/*.[jt]s?(x), **/?(*.)+(spec|test).[tj]s?(x) - 44 matches
  testPathIgnorePatterns: \\node_modules\\ - 814 matches
  testRegex:  - 0 matches
Pattern: test\components\checkBox\treezCheckBox.test.js - 0 matches

=> , .

:

jest test\\components\\checkBox\\treezCheckBox.test.js

vscode $ {file}, , , "\" .

Also see the discussion and related questions at https://github.com/Microsoft/vscode/issues/40256 (The last statement is deprecated; $ {lativeFile} also uses "\".)

Workaround: Use a debug extension (e.g. Daddy Jest ) instead of a custom launch configuration.

0
source

Source: https://habr.com/ru/post/1681568/


All Articles