[英]Jest Tests not running with jest-mongodb preset
I have a set up a the jest starter to get integration tests running against an in memory mongodb with jest-mongodb我设置了一个jest starter来使用jest-mongodb对内存中的 mongodb 运行集成测试
"jest": {
"preset": "@shelf/jest-mongodb",
However, running npx jest all I get is但是,运行 npx jest 我得到的只是
> jest-starter@1.0.0 test my/path/jest-starter
> jest
Determining test suites to run...(node:10769) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
If I run the tests without jest-mongodb it runs fine.如果我在没有 jest-mongodb 的情况下运行测试,它运行良好。 In our CI the tests also will execute fine.
在我们的 CI 中,测试也将正常执行。
> jest-starter@1.0.0 test /my/path/jest-starter
> jest
PASS ./index.spec.js
✓ adds 1 + 2 to equal 3 (3ms)
✓ adds 5 + 8 to equal 13
Test Suites: 1 passed, 1 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 5.503s
Ran all test suites.
I have Windows 10 with ubuntu subsystem.我有带有 ubuntu 子系统的 Windows 10。
node version 13.9.0节点版本 13.9.0
npm version 6.13.7 npm 版本 6.13.7
package.json:包.json:
"jest": {
"transform": {
"^.+\\.jsx?$": "babel-jest"
},
"preset": "@shelf/jest-mongodb"
},
"dependencies": {
"@shelf/jest-mongodb": "^1.2.2",
"mongodb": "^3.6.0"
},
"devDependencies": {
"@babel/core": "^7.7.7",
"@babel/preset-env": "^7.7.7",
"babel-jest": "^24.9.0",
"jest": "^24.9.0"
}
Any ideas what might be wrong here?任何想法这里可能有什么问题?
Okay, found the solution.好的,找到了解决方案。 I was on the right track, the error was caused by the ubuntu subsystem.
我在正确的轨道上,错误是由 ubuntu 子系统引起的。 Found the solution at the github page for jest-mongodb
在jest-mongodb 的 github 页面上找到了解决方案
Ubuntu is missing a dependency required by jest-mongodb: Ubuntu 缺少 jest-mongodb 所需的依赖项:
sudo apt-get install libcurl3
solved it.解决了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.