在nodejs中运行mocha测试的问题

问题描述 投票:1回答:1

我在运行 "npm run test "时得到了以下错误。

enter image description here

而我的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"
  }
}

我试着用命令全局安装mocha。

npm i -g mocha  

即使在安装之后,我也得到了上述相同的错误。谁能告诉我,我做错了什么?

更新。 我的机器是在一个公司的代理后面

node.js mocha chai
1个回答
1
投票

这似乎是一个问题 nyc 本身。尝试更新到这个github问题中建议的版本。https:/github.comistanbuljsnycissues1205)。.

© www.soinside.com 2019 - 2024. All rights reserved.