如何修复Windows 10上的Jest“未找到测试”?

And*_*sen 5 jestjs

我试图在Windows 10台式计算机上使用Jest,但它一直告诉我没有找到测试。在我的Windows 10笔记本电脑上,它工作正常。这是我在桌面上得到的输出:

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
Run Code Online (Sandbox Code Playgroud)

在我的package.json文件中,我的笑话配置如下所示:

"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"
}
Run Code Online (Sandbox Code Playgroud)

我正在使用节点8.1.4和jest v20.0.4,关于如何通过jest定位测试的任何想法?

Mat*_*jaG 4

我不能 100% 确定这是同一个问题。但对我来说解决这个问题的是摆脱守望者(我将其添加到另一个使用中继的项目的路径中)。尝试使用 --no-watchman 运行(或在 jest 配置中设置 watchman: false )