简体   繁体   English

在 nodejs 中运行 mocha 测试的问题

[英]Issue running mocha tests in nodejs

I'm getting the following error while running "npm run test":运行“npm run test”时出现以下错误:

在此处输入图像描述

And my package.json is as follows:而我的package.json如下:

{
 "name": "express-app",
 "version": "1.0.0",
 "private": true,
 "scripts": {
   "start": "node ./bin/www",
   "test": "nyc --reporter=lcov mocha ./tests/unitTests --color",
   "integrationTest": "mocha ./tests/integrationTests --exit"
},
 "dependencies": {
  "cookie-parser": "1.4.3",
  "cors": "^2.8.5",
  "debug": "2.6.9",
  "ejs": "2.5.9",
  "express": "4.16.3",
  "express-mung": "0.5.1",
  "express-validation": "^3.0.2",
  "http-errors": "1.6.3",
  "mongoose": "^5.9.7",
  "prom-client": "11.3.0",
  "swagger-ui-express": "4.0.4"
  },
 "devDependencies": {
   "chai": "4.2.0",
   "chai-http": "4.3.0",
   "mocha": "6.1.4",
   "nyc": "14.1.1"
  }
}

I have tried installing mocha globally using the command:我尝试使用以下命令全局安装 mocha:

npm i -g mocha  

Even after which I'm getting the above same error.即使在此之后我也遇到了上述相同的错误。 Can anyone please let me know what Im doing wrong?谁能让我知道我做错了什么?

UPDATE:更新:
My machine is behind a corporate proxy我的机器在公司代理后面

This seems like a problem with nyc itself.这似乎是nyc本身的问题。 Try updating to the version suggested in this github issue: https://github.com/istanbuljs/nyc/issues/1205 .尝试更新到此 github 问题中建议的版本: https://github.com/istanbuljs/nyc/issues/1205

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM