开玩笑 没有找到测试 [英] Jest No Tests found
问题描述
在 macOS 上运行 docker mhart/alpine-node:8
running docker mhart/alpine-node:8 on macOS with
nodejs (6.10.3-r0) (18/18)纱线 0.24.6开玩笑 20.0.4
nodejs (6.10.3-r0) (18/18) yarn 0.24.6 jest 20.0.4
我有一个 __tests__/index.test.js 文件,但是在运行代码时
I have a __tests__/index.test.js file however, when running the code
node_modules/.bin/jest --watchAll
我得到以下输出
未找到测试
在/usr/src/app
检查了 5 个文件.
testMatch:/__tests__//*.js?(x),**/?(*.)(spec|test).js?(x) - 1 匹配
testPathIgnorePatterns:/node_modules/,/src,src - 0 个匹配
模式:"" - 0 个匹配
No tests found
In /usr/src/app
5 files checked.
testMatch: /__tests__//*.js?(x),**/?(*.)(spec|test).js?(x) - 1 match
testPathIgnorePatterns: /node_modules/,/src,src - 0 matches
Pattern: "" - 0 matches
我已经重新安装了软件包编号,但无济于事.
I've re-installed the package numbers times but to no avail.
推荐答案
您的输出显示 testMatch
有 1 个匹配
,这可能是您的 __tests__/index.test.js
文件.您的 testPathIgnorePatterns
似乎导致该测试套件被忽略.No tests found In/usr/src/app
表示 Jest 正在 /usr/src/app
和 testPathIgnorePatterns:/node_modules/,/src,src
表示 Jest 忽略了 /src
目录中的文件.
Your output says that testMatch
had 1 match
, which may be your __tests__/index.test.js
file. It seems that your testPathIgnorePatterns
is causing that test suite to be ignored. No tests found In /usr/src/app
says that Jest is looking for tests in /usr/src/app
, and testPathIgnorePatterns: /node_modules/,/src,src
says that Jest is ignoring files in /src
directories.
如果 __tests__/index.test.js
文件在/src 目录之外,请指向 Jest 查看它的位置,或者阻止 testPathIgnorePatterns
忽略/src 目录.
Either point Jest to look at the location of your __tests__/index.test.js
file if it is outside the /src directory, or stop testPathIgnorePatterns
from ignoring the /src directory.
这篇关于开玩笑 没有找到测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!