Quantcast
Channel: Chutzpah - A JavaScript Test Runner
Viewing all articles
Browse latest Browse all 1864

Commented Unassigned: Files used as dependencies/references are instrumented by blanket even if they aren't the file being tested. [197]

$
0
0
Is there any way to include/exclude from code coverage on a per file basis.

For example I have my directory structure like this:

```
static\
scripts\
SomeModule\
GlobalObject.SomeModule.Utils.js
GlobalObject.SomeModule.Models.js
GlobalObject.SomeModule.js
GlobalObject.js
tests\
```

I replicate the directory and file structure in `tests\`, but on the files I insert .Tests right before the .js extension

Okay so that being said. So if I wante to test `GlobalObject.SomeModule.Models.js` I would have a file named `GlobalObject.SomeModule.Models.Tests.js`. The way I have my tests and coverage set up I run each test file and only collect code coverage for the file that it's testing. To me it seems like code coverage on files not being tested is useless. So I let razor generate my html using a layout and all that and so I can include any .js files that are dependencies for the file I am wanting to test and add a `data-cover` flag to the script tag that I want covered.

I'm just wondering is there a way to duplicate that functionality. For example it would be nice if you had to specify what you want covered instead of Chutzpah covering everything...

Using the example above I would do this in my `GlobalObject.SomeModule.Models.Tests.js` file:

/// <chutzpah_reference path="GlobalObject.js" />
/// <chutzpah_reference path="GlobalObject.SomeModule.js" />
/// <chutzpah_reference path="GlobalObject.SomeModule.Models.js" data-cover />

/* Test code would go here and it would only be testing GlobalObject.SomeModule.Models.js thus that would be the only thing blanket needs to instrument/cover */

Please let me know your thoughts on this and I hope that it makes sense. I really like the idea of Chutzpah especially because of the Visual Studio and TFS integration, but currently it will not work for us, but that being said I don't think what I'm asking is too crazy seeing as that's how blanket.js works.
Comments: I like your suggestion because you still get blankets functionality as well as the original Chutzpah functionality. I would like to send a pull request, but I am sure by the time I got around to learning the code base, developing, and debugging your future release would be out. That doesn't mean I won't try I'm just saying you will probably (hopefully) beat me to it! Thanks for Chutzpah and the visual studio extensions.

Viewing all articles
Browse latest Browse all 1864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>