我尝试使用nodemon自动运行测试,而不是手动运行。我一次安装了mocha和nodemonn。这就是我的package.json的样子:
{
"name": "Ti Ri Ho",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "nodemon --exec 'mocha -R min'"
},
"author": "",
"license": "ISC",
"dependencies": {
"mocha": "^5.2.0",
"mongoose": "^5.3.15",
"nodemon": "^1.18.7"
}
}
我将"scripts": {"test": "mocha" }
更改为“脚本”:{"test": "nodemon --exec 'mocha -R min'"}
。可能是什么原因?