istanbul

No coverage information was collected, istanbul coverage. (answer for similar issues in page is not work for me)

吃可爱长大的小学妹 提交于 2019-12-10 19:06:47
问题 i user this command: set CODACY_PROJECT_TOKEN=my_token&& istanbul cover --report lcov node_modules/mocha/bin/_mocha -- -r babel-register -r ./test_helper.js \"test/**/*@(.js|.jsx)\" Then i take passed in all test case but "No coverage information was collected" is show. I have no idea to fix it. can you help me? 回答1: I used babel-node and babel-istanbul modules and it works form me. I am using below command. babel-node node_modules/.bin/babel-istanbul cover _mocha -- --recursive tests/test.*

Jasmine unit test case for $routeChangeStart in AngularJS

两盒软妹~` 提交于 2019-12-10 15:24:08
问题 Hi I am building an app using AngularJS and now I am on to the unit testing my application. I know how to write unit test cases for services, controllers etc. But I don't know to write it for $routeChangeStart . I have following code in my app.js app.run(function ($rootScope, $location, AuthenticationService) { $rootScope.$on('$routeChangeStart', function () { if (AuthenticationService.isLoggedIn()) { $rootScope.Authenticated = 'true'; $rootScope.Identity = localStorage.getItem(

Istanbul code coverage for Mocha tests

三世轮回 提交于 2019-12-10 00:55:16
问题 I am trying to get Istanbul to work. I keep getting this message at the end of running istanbul: No coverage information was collected, exit without writing coverage information I have tried everything I could find online as you can see: "scripts": { "start": "node ./bin/start.js", "test": "mocha test --no-timeouts", "debug_mocha": "node-debug --no-timeouts _mocha", "eslint": "eslint .", "jshint": "jshint --exclude ./node_modules .", "istanbul": "istanbul cover --include-all-sources --hook

getting nyc/istanbul coverage report to work with typescript

风流意气都作罢 提交于 2019-12-09 15:28:17
问题 I'm struggling to get proper coverage with nyc/istanbul for my typescript/mocha/gulp project. I've tried a number of approaches, some of them seem to be unable to use source maps and other fails due to ts-node / tsc errors. My current setup is: nyc relevant config in package.json "scripts": { "test:coverage": "nyc npm run test:unit", "test:unit": "gulp mocha" } "nyc": { "check-coverage": true, "all": true, "extension": [ ".js", ".jsx", ".ts", ".tsx" ], "include": [ "src/**/!(*.test.*).[tj]s?

How to make Istanbul generate coverage for all of my source code?

坚强是说给别人听的谎言 提交于 2019-12-08 14:37:50
问题 Currently Istanbul is only generating coverage for files that are used in my tests, which is okay, but seems to defeat the purpose of having coverage somewhat. I have no Istanbul configuration, and am invoking it via npm test with the following script string: $ istanbul cover _mocha -- -R dot --check-leaks --recursive test/ Is there a way to generate coverage for all of my source code? 回答1: Found the answer, I think I'm partly lucky that the directory structure I have chosen allows me to use

Teamcity + NYC + Istanbul - generate test coverage report

不羁岁月 提交于 2019-12-08 05:46:10
问题 I am trying to generate tests report into teamcity, everytime built is made. I've researched the several methods and ended up finding Istanbul's teamcity reporter: teamcity Now I am trying to integrate it into teamcity, but I've not found any instructions about it. 回答1: All you need to do is add a script target in your package.json that uses the reporter: "script": { ... "coverage:teamcity": "nyc --reporter=teamcity mocha ...etc..." ... } Then, in your build step, simply invoke it via command

Angular2 - http call Code coverage

北慕城南 提交于 2019-12-06 19:36:46
问题 My components.ts is, getHomePageData() : void{ this.homeservice.getHomePageData() .subscribe( data => { //console.log("response status ################### "+data.status); //console.log("getUserData response ************ \n"+JSON.stringify(data)); this.defaultFacilityId = data.response.defaultFacilityId; this.defaultFacilityName = data.response.defaultFacilityName; this.enterpriseId = data.response.enterpriseId; this.enterpriseName = data.response.enterpriseName; this.facilityList = data

Code coverage on JSX tests with Istanbul

别来无恙 提交于 2019-12-06 01:52:40
问题 I am trying to instrument my code to get some coverage up and running, but something is slipping through my fingers. I launch istanbul with: node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- -u exports -R spec And my mocha.opts looks like this: app/assets/javascripts/components/**/*-mocha.jsx --compilers jsx:mocha/compiler.js Everything seems to run fine (the tests run, at least), but the only coverage that I get is on the files used to compile the JSX to JavaScript (used in

Istanbul nyc to exclude test files

血红的双手。 提交于 2019-12-05 15:44:03
问题 I'm currently getting my test files in the final coverage. That's probably because they sit alongside my components instead of having their own test folder. How can I exclude these from the coverage? I have installed istanbul and nyc and I'm using mocha . My script looks like: "test": "nyc --reporter=html mocha tools/testSetup.js app/**/*.spec.js || true" 回答1: Right, after some digging I've managed to get this working. I've added "nyc": { "include": "app", - only looks in the app folder

Angular2 - http call Code coverage

时光毁灭记忆、已成空白 提交于 2019-12-05 01:04:30
My components.ts is, getHomePageData() : void{ this.homeservice.getHomePageData() .subscribe( data => { //console.log("response status ################### "+data.status); //console.log("getUserData response ************ \n"+JSON.stringify(data)); this.defaultFacilityId = data.response.defaultFacilityId; this.defaultFacilityName = data.response.defaultFacilityName; this.enterpriseId = data.response.enterpriseId; this.enterpriseName = data.response.enterpriseName; this.facilityList = data.response.facilityList; this.userName = data.response.userName; this.showDefaultPopoup(); }, error => {