istanbul

How to generate nyc report from json results (no .nyc_output)?

被刻印的时光 ゝ 提交于 2021-02-08 10:59:50
问题 I've inherited a JS code base with Jasmine unit tests. The testing framework uses karma and instanbul-combine to get code coverage. It seems istanbul-combine isn't working with present node modules, and besides is no longer maintained: the recommended replacement is nyc . I'm having trouble replacing istanbul-combine with nyc in the Makefile . I succeeded in merging my separate coverage results (json) files into a single coverage-final.json file (this SO question), but now I need to generate

Exports defaults else path not taken with Jest and ES6

元气小坏坏 提交于 2021-02-07 19:22:22
问题 I'm having issues to pass my tests with 100% coverage. Istanbul say that exports defaults Component else path not taken. Because of that, I see in my generated html of istanbul that my tests are not completely at 100%. Mostly in the Statements and Branches tab. I'm using: React: 15.4.0 Jest: 17.0.2 Webpack: 1.12.11 Any idea? 回答1: The problem was in the jest configuration, we were using a preprocessor in order to resolve some imports: In the package json we had this: "transform": { "^.+\\.js$"

JS code coverage with selenium tests

南楼画角 提交于 2021-01-29 03:11:52
问题 I’m new to the entire concept of capturing JS coverage. The way I intend to use JS coverage tool is to check how many lines of my JS code is being hit by my tests running in a browser, thus using code coverage to improvise my test coverage. Can somebody guide me to an example/tool of how to capture JS coverage for the test running using selenium webdriver. 回答1: A tool like nyc is what you need. Take your js file(s) and run something like nyc instrument on them and nyc will modify the js files

Test code coverage javascript es6 generators (redux-saga / istanbul.js)

痞子三分冷 提交于 2021-01-27 14:33:05
问题 Working with redux-saga, I wrote some tests. I tried to generate code coverage using istanbul.js. It works fine for most of the code but the result for the sagas is broken: seems like random information. Anyone knows how to solve this ? 回答1: I personally use Jest, which includes code coverage and it seems to work fine with my sagas. I also wrote a test utility to help testing sagas (redux-saga-testing), and in the repo, you'll find examples of tests written with Jest, Mocha and AVA. Both Jest

Cannot get code coverage with Cypress + Istanbul

廉价感情. 提交于 2021-01-22 08:04:42
问题 I tried setting up code coverage in an Angular 8 project using Cypress and istanbul nyc . I managed to get the code instrumented (the global variable __coverage__ is properly set) : and the coverage file generated in .nyc_output after running cypress:open But the generated coverage report is empty: $ cat coverage/coverage-final.json {} Same result when I execute the command: $ npx nyc report --report-dir ./coverage --temp-dir .nyc_output --reporter=text ----------|----------|----------|------

Cannot get code coverage with Cypress + Istanbul

假装没事ソ 提交于 2021-01-22 08:02:39
问题 I tried setting up code coverage in an Angular 8 project using Cypress and istanbul nyc . I managed to get the code instrumented (the global variable __coverage__ is properly set) : and the coverage file generated in .nyc_output after running cypress:open But the generated coverage report is empty: $ cat coverage/coverage-final.json {} Same result when I execute the command: $ npx nyc report --report-dir ./coverage --temp-dir .nyc_output --reporter=text ----------|----------|----------|------

Node.js Mocha Testing Restful API Endpoints and Code Coverage

爷,独闯天下 提交于 2021-01-21 09:21:00
问题 I've been really enjoying Istanbul and experimenting with other Node.js coverage libraries as well, but I have an issue. Nearly all of my unit tests are HTTP calls to my API like so: it('should update the customer', function (done) { superagent.put('http://myapp:3000/api/customer') .send(updatedData) .end(function (res) { var customer = res.body; expect(res.statusCode).to.equal(200); expect(customer.name).to.equal(updatedData.name); done(); }); }); As opposed to actually requiring the

Node.js Mocha Testing Restful API Endpoints and Code Coverage

为君一笑 提交于 2021-01-21 09:20:58
问题 I've been really enjoying Istanbul and experimenting with other Node.js coverage libraries as well, but I have an issue. Nearly all of my unit tests are HTTP calls to my API like so: it('should update the customer', function (done) { superagent.put('http://myapp:3000/api/customer') .send(updatedData) .end(function (res) { var customer = res.body; expect(res.statusCode).to.equal(200); expect(customer.name).to.equal(updatedData.name); done(); }); }); As opposed to actually requiring the

Node.js Mocha Testing Restful API Endpoints and Code Coverage

荒凉一梦 提交于 2021-01-21 09:20:51
问题 I've been really enjoying Istanbul and experimenting with other Node.js coverage libraries as well, but I have an issue. Nearly all of my unit tests are HTTP calls to my API like so: it('should update the customer', function (done) { superagent.put('http://myapp:3000/api/customer') .send(updatedData) .end(function (res) { var customer = res.body; expect(res.statusCode).to.equal(200); expect(customer.name).to.equal(updatedData.name); done(); }); }); As opposed to actually requiring the

如何在 3 年内从 P7 晋升 P8

我的未来我决定 提交于 2021-01-03 07:20:01
正文如下 本文是第十四届 - 前端早早聊成长晋升专场,也是早早聊第 99 场,来自 阿里云- - 亦才 的分享 个人介绍 所幸,大家讲的东西跟我今天要讲的不一样,我觉得还是比较不错的。要不然我讲的东西都是一样的话,估计大家听的也比较乏味了。 看一下我在阿里的经历,我是 2014 年加入淘宝,2019 年在阿里云,做的事情也比较多。在淘宝的时候做过业务,也做过技术产品。在阿里云这边也做过业务,也做过很多技术产品以及基础设施的建设。 大纲 今天会讲两个部分,第一个是 成长 ,第二个是 晋升 。 成长 成长这块我会多讲一些,这块我会分三个部分来讲。第一个是 成长模型 ,因为我希望大家在听完我这个 PPT 之后有一些收获,而不是说听完之后就没了。第二个是怎么去 建立自己的技术栈 。第三个是比较核心的问题是 怎么在业务中去成长 。 一、成长模型 首先是成长模型,从我自己的个人经历去总结的一个模型,外界不一定有。会分三个层次,第一个是 解决问题 的阶段,第二个是 发现问题 的阶段,第三个是 定义问题 的阶段。三个阶段都会通过一个案例去做分析,在案例里面每个阶段都是怎么去做的。 这个案例是之前做了一个技术产品叫做 UITEST,它是用来做单元测试以及 UI 测试的,这边会重点说一下单元测试。整个阶段是从下往上是一个上升的趋势。 解决问题 。先看一下解决问题这个阶段是怎么成长的?我们在做