Настройка покрытия кода с мокко, Стамбул, Нью-Йорк комбинезон в ES6
Я работаю над проектом node.js, и мне нужно добавить покрытие кода и значок в мой проект. Я следовал этому руководству ( http://dsernst.com/2015/09/02/node-mocha-travis-istanbul-coveralls-unit-tests-coverage-for-your-open-source-project/) Дэвида Эрнста. Однако каждый раз, когда я запускаю какой-либо из сценариев, я получаю сообщения об ошибках, которые я не понимаю. Я пробовал другие учебники, и я все еще получаю ошибки. Мне нужна помощь. Мне нужно знать, как правильно это настроить, включая nyc. Разъяснение деталей установки действительно поможет.
Вот мой package.json и ошибка меня
{
"name": "stackru-lite",
"version": "1.0.0",
"description": "Stackru-lite is a platform where people can as questions about challenges and get answers. They can also provide answers to other people questions.",
"main": "app.js",
"scripts": {
"lint": "eslint server/",
"start": "babel-node app.js",
"dev-start": "nodemon --exec babel-node app.js",
"test": "mocha server/**/*.js --require babel-register --timeout 1000",
"pretest": "babel-node server/models/index.js",
"coveralls": "npm run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls",
"cover": "istanbul cover _mocha"
},
"repository": {
"type": "git",
"url": "git+https://github.com/davidshare/Stackru-lite.git"
},
"author": "David Essien",
"license": "ISC",
"bugs": {
"url": "https://github.com/davidshare/Stackru-lite/issues"
},
"homepage": "https://github.com/davidshare/Stackru-lite#readme",
"devDependencies": {
"babel-preset-env": "^1.7.0",
"coveralls": "^3.0.2",
"eslint": "^5.3.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.11.1",
"mocha": "^5.2.0",
"mocha-lcov-reporter": "^1.3.0"
},
"dependencies": {
"babel-cli": "^6.26.0",
"babel-register": "^6.26.0",
"bcrypt": "^3.0.0",
"body-parser": "^1.18.3",
"chai": "^4.1.2",
"chai-http": "^4.0.0",
"dotenv": "^6.0.0",
"express": "^4.16.3",
"jsonwebtoken": "^8.3.0",
"pg": "^7.4.3"
},
"engines":{
"node": "8.11.1",
"npm": "5.6.0"
}
}
и вот сообщение об ошибке я продолжаю получать
No coverage information was collected, exit without writing coverage information
C:\Users\Davidshare\Documents\code dojo\js\Stackru-lite\node_modules\.bin\_mocha.CMD:1
(function (exports, require, module, __filename, __dirname) { @IF EXIST "%~dp0\node.exe" (
^
SyntaxError: Invalid or unexpected token
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Object.Module._extensions.(anonymous function) [as .js] (C:\Users\Davidshare\Documents\code dojo\js\Stackru-lite\node_modules\istanbul\lib\hook.js:109:37)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at runFn (C:\Users\Davidshare\Documents\code dojo\js\Stackru-lite\node_modules\istanbul\lib\command\common\run-with-cover.js:122:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! stackru-lite@1.0.0 cover: `istanbul cover _mocha "--report" "lcovonly"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the stackru-lite@1.0.0 cover script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Davidshare\AppData\Roaming\npm-cache\_logs\2018-09-02T08_13_52_635Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! stackru-lite@1.0.0 coveralls: `npm run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the stackru-lite@1.0.0 coveralls script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: