Comments (7)
Looks like dojo may be doing something that doesn't play well with what istanbul does.
In order for me to debug this, would it be possible for you to set up a small project on github with package.json, code, tests etc. and give me a link? That way I can start looking at the problem rather than trying to figure out how to set up all this.
from istanbul.
you can download the zip and unzip it if that's easier for you.
Once you unzip it, I was running the command
istanbul cover istanbul-test.js (for scenario 1)
istanbul cover istanbul-test2.js (for scenario 2)
here is the link: https://github.com/adabadyitzaboy/istanbul-AND-dojo
from istanbul.
OK, looked at your examples, thanks for providing something simple for me to work with.
Two issues:
- dojo uses
vm.runInThisContext
to load the user code so you need to pass--hook-run-in-context
to theistanbul cover
command - There is an issue with the way filenames are matched for the purposes of hooking - the current code assumes that absolute path names will be passed to it whereas in the dojo case it is getting a relative path name (i.e.
./test.js
as opposed to/path/to/file/test.js
)
For fixing (2) temporarily to make progress (I will provide a proper fix later):
Change this line: https://github.com/gotwarlost/istanbul/blob/master/lib/hook.js#L43
to read as:
var shouldHook = matcher(require('path').resolve(filename))
That should get you to a state where the coverage report shows test.js
covered at 100% when using the command:
$ ./istanbul cover --hook-run-in-context istanbul-test.js
Let me know if that works and any other issues you find after this. Thanks!
from istanbul.
Awesome!
This helped so much! Now I just need to figure out if I can fake a browser so that i can have the global window.
from istanbul.
JSDOM maybe? https://github.com/tmpvar/jsdom
from istanbul.
Thank you for your help.
JSDOM definately did the job for me.
I was able to work through some other issues and now everything is working fine. Thank you so much. I was beating my head against the wall for the 1st issue. Now we have code coverage :). Now to just get it to an acceptable range before showing the head bosses ...hehehe
from istanbul.
path fix available in v0.1.35
from istanbul.
Related Issues (20)
- ignore lines of code by specifying the line numbers HOT 1
- Function to string without istanbul in runtime HOT 1
- Looking for Constantinople.js HOT 1
- is it possible to apply the effect from /* istanbul ignore next */ to all typescript private methods automagically?
- option to disable coverage on import lines
- Open Coverage File Automatically on Test Command? HOT 2
- Branches that don't exist get reported as missing
- how to use istanbul as a library
- Analyzing coverage of node server in Windows HOT 1
- exclude imported node modules from coverage reporting HOT 1
- Cannot get the backend coverage by running Cypress UI e2e test HOT 1
- Ignore implied "else"
- Coverage format documentation not explicitly stating 'end' meaning HOT 1
- Istanbul doesn't ignore nested if, when not executed
- Async package is vulnerable
- Coverage not being collected from file called "payload.ts"
- Fails when running `istanbul report` HOT 1
- Unit test branch for SignInPage showing the SignUpComponent
- Ignore docs could be clarified by adding a list of allowed keywords
- Code comments are being covered.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from istanbul.