istanbuljs | monorepo containing the various nuts and bolts that facilitate istanbuljs test instrumentation | Runtime Evironment library
kandi X-RAY | istanbuljs Summary
kandi X-RAY | istanbuljs Summary
This monorepo contains the nuts and bolts utility libraries that facilitate IstanbulJS test coverage; Why a monorepo?.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Initialize a new App .
- Outputs a branch coverage information for a file coverage .
- Visits a program .
- Retrieves the mapping for the given source location .
- Generate header .
- annotated code coverage
- Create a summary template for a report .
- Generate a table row .
- Checks to see if a node coverage is missing
- Returns the original end position of the given range .
istanbuljs Key Features
istanbuljs Examples and Code Snippets
Community Discussions
Trending Discussions on istanbuljs
QUESTION
In my unit tests I have one case where I get a promise from a browser API (IndexedDB) and added a catch clause to handle any error condition. For obvious reasons I cannot trigger the promise to fail in my tests. After all this is internal to the browser.
That's why I want to ignore the catch clause for code coverage. How can I do that?
Note: for try/catch blocks it is possible to write the istanbul ignore hint like this:
...ANSWER
Answered 2022-Jan-14 at 15:27The place to add the ignore hint is directly before the closure in the catch clause:
QUESTION
My code coverage report shows 100% covered source code. However, I would expect less because there is only one test file (FooPage.spec.js
) covering one (FooPage.vue
) of two components. The second component (BarPage.spec.js
) is shown in the report but not considered in the coverage metrics. I would have expected to see BarPage.ts
reported as red with 0/4 statements covered (instead of 0/0).
I guess, the instrumentation with nyc
does not work as expected with the all
option.
See https://github.com/toaditoad/code-coverage-mwe for a reproducible example.
See https://github.com/istanbuljs/nyc/issues/1415 with same question as well.
...ANSWER
Answered 2021-Jul-08 at 05:24See Readme of my updated working example for a (not so nice) workaround to add all source files as additional entries in Cypress' webpack preprocessor: https://github.com/toaditoad/code-coverage-mwe
This only works for Cypress 6.x but raised as request for Cypress 7.x which does not support the webpack preprocessor: https://github.com/cypress-io/cypress/issues/17230
QUESTION
The tests in my project were working fine when I first started using them, currently they have stopped working at all.
Whenever I use the test command the following error is thrown:
...ANSWER
Answered 2021-Jun-03 at 11:08I encountered the same problem.
Apparently, the csv-writer
package contains tests, like array.test.ts
specified in your stack trace.
This is your script used for running the mocha tests:
QUESTION
I have an old Angular application, which I have upgraded from Angular 9 to Angular 11. (It had many stable upgrades throughout the years, starting from Angular 2)
My problem is, that the ngcc
is not running ng build
:
ANSWER
Answered 2021-Feb-03 at 14:10My problem was that an another tsconfig
file was overwriting the root's definitions, and turned off ivy and ngcc altogether.
sr5c/tsconfig.app.json
:
QUESTION
I have been trying to get Cypress code coverage working with my Angular production project to no avail.
To try and help diagnose it, I have created a minimal implementation project to make sure I wasn't introducing anything weird in the production version, which I don't think I am as the same issue is still happening. It's starting to drive me mad!
I have used a few references and as far as I can see I have the things in place I need to:
As far as I can tell the Angular and Cypress side is all hooked up and am getting output in the .nyc_output folder and a coverage report. However the report is not indicating typescript line coverage or including those stats.
I have seen this but didn't seem to help.
Code Instrumentation (webpack extension + angular.json):
...ANSWER
Answered 2020-Jun-15 at 00:49Comparing ang-cy-cov-example to your package.json, a major difference is that he uses @cypress/code-coverage@1.14.0 where-as you have the latest v3.8.1.
Changing back to this v1.14.0 works ok with your setup. Since your info indicates data is appearing in .nyc_output/out.json
, I tested with the command line ./node_modules/.bin/nyc report
which gives a quick view in the console.
Comparing .nyc_output/out.json
between the two versions, the individual nodes are structurally the same, i.e have the correct sections (path, statementMap, inputSourceMap etc).
There are two types of additional nodes
additional files such as karma.conf.js, coverage.webpack.js, cy-ts-preprocessor.js, integration/spec.ts, support/commands.ts - which we are not interested in.
the files we are interested in are duplicated at the end of the file but the duplicates have no coverage metrics.
e.g
First copy of main.ts with metrics
QUESTION
istanbuljs does not report the code coverage properly in case of callback function like in this example:
...ANSWER
Answered 2020-Mar-03 at 11:54I just saved in a separated function the callback function to fix the istanbuljs code coverage report.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install istanbuljs
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page