-
Notifications
You must be signed in to change notification settings - Fork 787
"istanbul ignore next" over methods of an es6 class #445
Comments
+1 to this. Having issues ignoring an |
Found a workaround (spaces before and after the comment seem to be necessary): class Foo {
bar /* istanbul ignore next */ () {
return 'biu~';
}
} |
+1 |
If you're using {
"presets": ["es2015"],
"plugins": [
["transform-es2015-classes", {
"loose": true
}]
]
} This will generate code like this: /* istanbul ignore next */
MyClass.prototype.myMethod = function () { } Which istanbul understands perfectly EDIT: Otherwise _createClass(MyClass, [{
key: "myMethod",
/* istanbul ignore next */
value: function myMethod() {}
}]); |
+1 for this |
half way through 2016 now.. any update on this? |
+1 |
This is still an issue, having to put the comment between descriptor and signature is a horrible looking hack I have to say. |
+1 |
+1. Beginning of 2017, I am still waiting. |
ye, I have agree with this. I didn't use coverage before, but now that i am using react-boilerplate, I do find it valuable. I also understand (from a Martin Fowler article) that we shouldn't be neurotic over getting 100% coverage. However I find it cumbersome to have to go through the whole list of files and percentages, to see wether a lack of coverage comes from files where I expect it to come from, or wether it is a new place where I actually should improve the testing. That's why I want to have it at 100% all the time, so I can see at once if something is wrong or not. /* istanbul ignore function */ would be great to have! |
+1 for |
class Foo {
bar /* istanbul ignore next */ () {
return 'biu~';
}
} This work-around doesn't work for this type of code: .then(data => {
},
error /* istanbul ignore next */ => {
// no matter what, cannot switch coverage off here
}); |
For es6 react app I just did this:
|
Who's still waiting for this in 2018? |
The following works for my React class using the version of Istanbul that comes with Jest 22.4 /* istanbul ignore next */
componentWillReceiveProps(props) {
// ...
} |
waiting for /* istanbul ignore function */
/* istanbul ignore file */
/* istanbul ignore start */
/* istanbul ignore end */ greetings from Istanbul,.. |
Currently using nyc v11.9.0 |
2019 +1 |
+1 to
It would be amazing. Or just an As a lot of time has already passed, what about |
Why they'd change it, I can't say. |
Hi! Here is an example what doesn't work and what works: This doesn't work: This works: The working example is not so nice to see and write... so my question is: Is there anyway to do it like in the first example? Or has the Istanbul team some plans to support such ignores? Thank you |
Is this issue even being monitored? @gotwarlost |
These two are really all that would be left from the op. They would alleviate the need for convenience the other two file and function commands though. They would be fantastic to have and likely would have garnered more usefulness overall, imho.
These two already exist and work from my testing with my typescript, istanbul, mocha, chia, sinon instance. |
@brycepelletier /* istanbul ignore function */ didn't work for me. |
...... 2020 |
I don't think this repo is updated anymore. The last commit was in 2017. |
It just became a tradition to come here once a year to check |
"karma-coverage-istanbul-reporter": "~2.0.1"
works for me in an angular-cli 8 project... EDIT: |
+1 in 2020. |
1 similar comment
+1 in 2020. |
+1 2020 |
A lot of weird stuff happened in 2020, maybe implementing this issue is one of them 🤔 |
I think that 2020 is weird enough |
If you are using TypeScript, make sure Oddly enough, when I had
|
2021+ |
2021+ /* istanbul ignore next */ not work like this with jest:
|
SitePen/remap-istanbul#106 (comment) problem solved by change the target to 'esnext' in tsconfig.json |
This is also a problem when unit testing Vue component props. Testing the prop defaults is currently tricky with vue-test-utils as the docs are wrong (a separate conversation for their repo). After much trial and error I figured out the correct magic place to put the It does not work when placed in the line above, or above Hope this helps anyone else with Vue/objects containing functions. export default {
name: 'ExampleComponent',
props: {
example: {
type: Array,
required: false,
default: /* istanbul ignore next */ () => [],
},
},
}; |
Hello from 2022+, it's been short 7 years of our nice friendship in this topic. |
Hello! Still having this problem. |
2024 |
Just to mention: this version of Istanbul is deprecated, see the README file. So you should not expect that it will get fixed, but rather check the latest version. |
I have this code and I don't understand how to migrate this to NYC
Maybe you can explain it to me? |
And I receive a report simply using Jest, as far as I understand istanbul this is the default solution for Jest, I don’t know how to configure jest + nyc |
Following example says, that doSomething is not covered, but i guess it should be "ignored"
if i move the ignore-comment into the method, the return is ignored, but the function is still uncovered
The text was updated successfully, but these errors were encountered: